Skip to content

fetch: further ref-prefix cleanups and optimizations

Jeff King git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 20 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9t5702: fix typo in test namet/t5702-protocol-v2.sh+1 -12 replies
2/9t5516: prefer "oid" to "sha1" in some test titlest/t5516-fetch-push.sh+3 -30 replies
3/9t5516: drop NEEDSWORK about v2 reachability behaviort/t5516-fetch-push.sh+0 -11 reply
4/9t5516: beef up exact-oid ref prefixes testt/t5516-fetch-push.sh+4 -10 replies
5/9refspec_ref_prefixes(): clean up refspec_item logicrefspec.c+16 -622 replies
6/9fetch: ask server to advertise HEAD for config-less fetchbuiltin/fetch.c t/t5702-protocol-v2.sh+23 -04 replies
7/9fetch: stop protecting additions to ref-prefix listbuiltin/fetch.c t/t5702-protocol-v2.sh+18 -61 reply
8/9fetch: avoid ls-refs only to ask for HEAD symref updatebuiltin/fetch.c t/t5702-protocol-v2.sh+15 -39 replies
9/9fetch: use ref prefix list to skip ls-refsbuiltin/fetch.c+7 -200 replies

Reviews trailers per patch

None of the 9 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchTaylor Blau
SeriesR-b
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/9] fetch: further ref-prefix cleanups and optimizations
Quoted 9 lines · Taylor Blau

Peff and I talked about this today, and neither of us could find any reasons not to pursue the approach listed in the footnote of

<[email protected]>

, but this is a more conservative approach that should fix the issue and apply cleanly on top of 'maint'. It may be worth picking this into 2.49, even though we are already quite late into the -rc cycle, this is a fairly nasty bug.

Yeah, I favor doing this simple fix first, and then trying the larger (and slightly riskier) change on top.

I started to write up that larger patch, and found a number of interesting things. ;) So here's a 9-patch series, which would apply on top of tb/fetch-follow-tags-fix (but can very much wait to cook in the next development cycle).

[1/9]: t5702: fix typo in test name
[2/9]: t5516: prefer "oid" to "sha1" in some test titles [3/9]: t5516: drop NEEDSWORK about v2 reachability behavior

Just some cosmetic fixes in nearby areas.

[4/9]: t5516: beef up exact-oid ref prefixes test

Improving test coverage in an area I'm about to touch.

[5/9]: refspec_ref_prefixes(): clean up refspec_item logic

Code clean-up. Not necessary (textually or semantically) for the other patches.

[6/9]: fetch: ask server to advertise HEAD for config-less fetch [7/9]: fetch: stop protecting additions to ref-prefix list [8/9]: fetch: avoid ls-refs only to ask for HEAD symref update

Here we get to the interesting bits. These get rid of the subtle dependency that led to this bug in the first place, and also optimize a few cases where we can narrow the ref advertisement.

The third one is a bit optimization, where we avoid a whole round-trip to the server. It's correct as far as the rest of the code behaves, but I'm not 100% sure that the new origin/HEAD update feature isn't a little buggy. See my comments there.

[9/9]: fetch: use ref prefix list to skip ls-refs

And then this is just a final bit of cleanup enabled by the earlier patches.

 builtin/fetch.c        | 46 +++++++++++++++++-------------------------
 refspec.c              | 22 ++++++++++++++------
 t/t5516-fetch-push.sh  | 12 ++++++-----
 t/t5702-protocol-v2.sh | 44 +++++++++++++++++++++++++++++++++++++++-
 4 files changed, 85 insertions(+), 39 deletions(-)

-Peff