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

Re: [PATCH] transport-helper: do not request symbolic refs to remote helpers

From
Mike Hommey <mh@glandium.org>
Date
Jan 22, 2015, 07:03 UTC
Message-ID
<20150122070301.GA18195@glandium.org>
In-Reply-To
<xmqqwq4fuxbb.fsf@gitster.dls.corp.google.com>
On Wed, Jan 21, 2015 at 10:46:48PM -0800, Junio C Hamano wrote:
Show 28 quoted lines
> Mike Hommey <mh@glandium.org> writes:
> 
> > A typical remote helper will return a `list` of refs containing a symbolic
> > ref HEAD, pointing to, e.g. refs/heads/master. In the case of a clone, all
> > the refs are being requested through `fetch` or `import`, including the
> > symbolic ref.
> >
> > While this works properly, in some cases of a fetch, like `git fetch url`
> > or `git fetch origin HEAD`, or any fetch command involving a symbolic ref
> > without also fetching the corresponding ref it points to, the fetch command
> > fails with:
> >
> >   fatal: bad object 0000000000000000000000000000000000000000
> >   error: <remote> did not send all necessary objects
> >
> > (in the case the remote helper returned '?' values to the `list` command).
> 
> Hmph.
> 
> Since the most "typical remote helper" I immediately think of is
> remote-curl and "git fetch https://code.googlesource.com/git HEAD"
> does not seem to fail that way, I am not sure what to make of the
> above.  It is unclear if you meant that the above is inherent due to
> the way how remote helper protocol works (e.g. there is only one
> thing we can associate with a ref and we cannot say "HEAD points at
> this commit" at the same time we say "HEAD points at
> refs/heads/master"), or just due to broken or lazy implementation of
> the remote helpers that are invoked by transport-helper.c interface.

Note the most important part is actually between the parens: that only happens when the remote helper returns '?' to the `list` command, which non-git remotes helpers (like git-remote-hg or git-remote-bzr) do. git-remote-testgit also does, so if you only apply the test parts of the patch, you'll see that the test fails.

remote-curl probably doesn't hit the problem because it's not returning '?' to `list`.

Mike
Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 8 in “transport-helper: do not request symbolic refs to remote helpers”
  1. transport-helper: do not request symbolic refs to remote helpersMike Hommey, Jan 19, 2015
  2. Junio C HamanoJan 22, 2015
  3. Mike HommeyJan 22, 2015
  4. Junio C HamanoJan 22, 2015
  5. Mike HommeyJan 22, 2015
  6. Junio C HamanoJan 22, 2015
  7. Mike HommeyJan 22, 2015
  8. Junio C HamanoJan 22, 2015

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.