Skip to content

v2 protocol can't "git pull" with restricted refspec

Jeff King git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fetch: stop checking for NULL transport->remote in do_fetch()builtin/fetch.c+1 -10 replies
2/2fetch: add branch.*.merge to default ref-prefix extensionbuiltin/fetch.c t/t5520-pull.sh+32 -35 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchJohannes Schindelin
1/2
2/2Helped-by

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/2] v2 protocol can't "git pull" with restricted refspec
Quoted 7 lines · Jeff King

This is a bug which we should fix. But in the meantime the obvious workaround is to expand the default refspec to cover both branches. Obviously the default of fetching "refs/heads/*" would work, but if you want to keep it limited for some reason, you can add the second branch explicitly. In the example above, it would be:

  git config --add remote.origin.fetch +refs/heads/branch2:refs/remotes/origin/branch2

And here's the patch to fix it. There was a small cleanup needed, hence the 2-patch series.

[1/2]: fetch: stop checking for NULL transport->remote in do_fetch() [2/2]: fetch: add branch.*.merge to default ref-prefix extension

 builtin/fetch.c | 18 +++++++++++++++---
 t/t5520-pull.sh | 17 +++++++++++++++++
 2 files changed, 32 insertions(+), 3 deletions(-)

-Peff