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

Re: BUG: fetch in certain repo always gives "did not send all necessary objects"

From
Elijah Newren <newren@gmail.com>
Date
Feb 7, 2018, 17:25 UTC
Message-ID
<CABPp-BH0rSELVJV11MJM=KFU2jAEuhVTzUUBskghgku+y_ozDQ@mail.gmail.com>
In-Reply-To
<20180207132157.GB16018@sigill.intra.peff.net>
On Wed, Feb 7, 2018 at 5:21 AM, Jeff King <peff@peff.net> wrote:
Show 9 quoted lines
> On Tue, Feb 06, 2018 at 04:00:32PM -0800, Elijah Newren wrote:
>
>> It took me hours to figure it out, after users ran out of ideas and
>> came and asked me for help.  (Maybe if I was familiar with worktree,
>> and knew they had been using it, then I might have guessed that "HEAD"
>> meant "not your actual HEAD but the HEAD of the vestige of some other
>> worktree").
>
> Yeah, this is the obvious thing that seems like it ought to be improved.
<snip>
Show 14 quoted lines
> Unfortunately fixing that is a little tricky. In this case the stack
> looks like:
>
>   parse_object_or_die (oid=0x7fffffffd690, name=0x555555792880 "HEAD") at object.c:239
>   add_one_ref (path=0x555555792880 "HEAD", oid=0x7fffffffd690, flag=0, cb_data=0x7fffffffd8e0) at reachable.c:38
>   refs_head_ref (refs=0x555555a65430, fn=0x5555556b6ef5 <add_one_ref>, cb_data=0x7fffffffd8e0) at refs.c:1316
>   other_head_refs (fn=0x5555556b6ef5 <add_one_ref>, cb_data=0x7fffffffd8e0) at worktree.c:404
>
> So other_head_refs knows that it's looking at the worktrees. And it
> passes the alternate ref-store to refs_head_ref(), with "add_one_ref" as
> the callback. But the knowledge that we're not talking about the real
> "HEAD" is lost as we cross that callback boundary. We'd need to either
> add another parameter to the callback, or have some way of talking about
> "HEAD in this worktree" as a refname (which AFAIK we don't have).

Can we use "worktrees/${WORKTREE}/HEAD"? It already satisfies all the necessary rev-parse rules...

(And on a slight tangent...do we want to start disallowing the creation of branches/tags whose name starts with "worktrees/", "refs/", "hooks/", or other paths that exists under gitdir? Making a branch named "refs/heads/foo" so that it fully-qualifies as "refs/heads/refs/heads/foo" is always fun)

Previous: Jeff KingNext: Jeff King
Message 9 of 10 in “BUG: fetch in certain repo always gives "did not send all necessary objects"”
  1. Elijah NewrenFeb 6, 2018
  2. Stefan BellerFeb 6, 2018
  3. Elijah NewrenFeb 7, 2018
  4. Duy NguyenFeb 7, 2018
  5. Jeff KingFeb 7, 2018
  6. Elijah NewrenFeb 7, 2018
  7. Jeff KingFeb 7, 2018
  8. Jeff KingFeb 7, 2018
  9. Elijah NewrenFeb 7, 2018
  10. Jeff KingFeb 7, 2018

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.