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

Re: [Non-Bug] cloning a repository with a default MASTER branch tries to check out the master branch

From
Jeff King <peff@peff.net>
Date
May 25, 2017, 19:11 UTC
Message-ID
<20170525191115.tqd6zlj5mxqls4wp@sigill.intra.peff.net>
In-Reply-To
<20170525155924.hk5jskennph6tta3@sigill.intra.peff.net>
On Thu, May 25, 2017 at 11:59:24AM -0400, Jeff King wrote:
> The just-HEAD case could look like:

This patch does work, in the sense that upload-pack advertises the unborn HEAD symref. But the client doesn't actually do anything with it. The capability parsing happens in get_remote_heads(), which passes the data out by adding an annotation to the "struct ref" list. But of course we have no HEAD ref to annotate.

So either get_remote_heads() would have to start returning a bogus HEAD ref (with a null sha1, I guess, which all callers would have to recognize). Or clone (and probably "remote set-head -a") would have to start reaching across the transport-module boundary and asking for any symref values for "HEAD". I'm not excited about more special-casing of "HEAD", though. In theory we'd want this for other symrefs in the long run, and it would be nice if clients were ready to handle that (even if the protocol isn't quite there).

I dunno. I was thinking there might be a quick tweak, but I'm wondering if this arcane case is worth the restructuring we'd have to do to support it. It only comes up when you've moved the server repo's HEAD to an unborn branch _and_ you have other refs (since otherwise we don't even send capabilities at all!).

-Peff
Previous: Jeff KingNext: Junio C Hamano
Message 8 of 17 in “[Bug] cloning a repository with a default MASTER branch tries to check out the master branch”
  1. Félix SaparelliMay 22, 2017
  2. Junio C HamanoMay 23, 2017
  3. Philip OakleyMay 23, 2017
  4. Jeff KingMay 24, 2017
  5. Junio C HamanoMay 25, 2017
  6. Junio C HamanoMay 25, 2017
  7. Jeff KingMay 25, 2017
  8. Jeff KingMay 25, 2017
  9. Junio C HamanoMay 25, 2017
  10. Philip OakleyMay 26, 2017
  11. Philip OakleyMay 26, 2017
  12. Junio C HamanoMay 27, 2017
  13. Philip OakleyMay 28, 2017
  14. Junio C HamanoMay 28, 2017
  15. Jeff KingMay 31, 2017
  16. Samuel LijinMay 23, 2017
  17. Jeff KingMay 23, 2017

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.