git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: 2.37.2 can't "git pull" but 2.18.0 can

From
LDLana Deere <lana.deere@gmail.com>
Date
Sep 9, 2022, 17:32 UTC
Message-ID
<CA+4x=b_eOO=ThnSkMARPXBH6cJLeuYPfF-PZNy4Vjpbk=BWQYw@mail.gmail.com>
In-Reply-To
<Yxow7zrYF/xOijVr@coredump.intra.peff.net>

I can use a workaround to continue testing 2.37.2, but I saw in a different mail that there has already been a patch for this problem. I'm guessing that will be in 2.37.4. When would that be likely to be available?

Thanks for the quick patch, by the way.
.. Lana (lana.deere@gmail.com)
On Thu, Sep 8, 2022 at 2:14 PM Jeff King <peff@peff.net> wrote:
Show 61 quoted lines
>
> On Thu, Sep 08, 2022 at 12:46:14PM -0400, Lana Deere wrote:
>
> > With an explicit -c protocol.version=0 on the 2.37.2 git command line,
> > the pull is successful.  For what it's worth, the server git is still
> > 2.18.0 in all of these cases.  Only the client side is being tested so
> > far.  I will try to gather the packet traces and see if there's a
> > problem sharing them.  Will this mailing list allow attachments?
>
> You can send attachments to the list as long as the total mail size is
> under 100kb. But to keep the list in the loop: Lana sent me the traces
> off-list, because naturally they have a bunch of semi-private ref names.
>
> I was able to see the problem from the traces: the v2 protocol has an
> extension to tell the server to limit the advertisement only to branches
> we're interested in. And it does so based on the configured refspec. As
> Dscho noted earlier in the thread, the upstream branch you want isn't in
> the refspec. We try to add that branch explicitly to what we're
> fetching, but I think that happens too late to affect the ref-prefix
> limiting. So the server is asked not to advertise the ref, and from the
> client's perspective, it looks like the branch does not exist on the
> server.
>
> Here's a minimal reproduction:
>
>   # a server with two branches
>   git init server
>   (
>     cd server
>     git checkout -b branch1
>     git commit --allow-empty -m foo
>     git branch branch2
>   )
>
>   # and a client which points its origin there,
>   # and has local copies of both branches, tracking
>   # the upstream versions
>   git clone server client
>   cd client
>   git checkout branch1
>   git checkout branch2
>
>   # but afterwards, the client narrows its refspec to only fetch branch1
>   git config remote.origin.fetch +refs/heads/branch1:refs/remotes/origin/branch1
>
>   # pulling branch2 with v0 works
>   git -c protocol.version=0 pull
>
>   # but does not with v2, because the ref-prefix extension tells the
>   # server not to advertise anything outside of branch1
>   git -c protocol.version=2 pull
>
> 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
>
> -Peff
Previous: Jeff KingNext: Junio C Hamano
Message 24 of 31 in “2.37.2 can't "git pull" but 2.18.0 can”
  1. Lana DeereSep 2, 2022
  2. brian m. carlsonSep 2, 2022
  3. Lana DeereSep 6, 2022
  4. Johannes SchindelinSep 7, 2022
  5. Lana DeereSep 7, 2022
  6. Jeff KingSep 8, 2022
  7. Jeff KingSep 3, 2022
  8. Lana DeereSep 6, 2022
  9. Đoàn Trần Công DanhSep 7, 2022
  10. Lana DeereSep 7, 2022
  11. Jeff KingSep 7, 2022
  12. Lana DeereSep 7, 2022
  13. Jeff KingSep 7, 2022
  14. Lana DeereSep 8, 2022
  15. Jeff KingSep 8, 2022
  16. 0/2 v2 protocol can't "git pull" with restricted refspecJeff King, Sep 8, 2022
  17. 1/2 fetch: stop checking for NULL transport->remote in do_fetch()Jeff King, Sep 8, 2022
  18. 2/2 fetch: add branch.*.merge to default ref-prefix extensionJeff King, Sep 8, 2022
  19. Junio C HamanoSep 8, 2022
  20. Junio C HamanoSep 8, 2022
  21. Jeff KingSep 9, 2022
  22. Junio C HamanoSep 9, 2022
  23. Jeff KingSep 11, 2022
  24. Lana DeereSep 9, 2022
  25. Junio C HamanoSep 9, 2022
  26. Lana DeereSep 12, 2022
  27. Jeff KingSep 13, 2022
  28. Johannes SchindelinSep 5, 2022
  29. Lana DeereSep 6, 2022
  30. Johannes SchindelinSep 7, 2022
  31. Lana DeereSep 7, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.