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

Re: [PATCH 3/5] clone: find the current branch more explicitly

From
Jeff King <peff@peff.net>
Date
Nov 30, 2008, 18:10 UTC
Message-ID
<20081130181011.GB10375@coredump.intra.peff.net>
In-Reply-To
<1228039053-31099-3-git-send-email-gitster@pobox.com>
On Sun, Nov 30, 2008 at 01:57:30AM -0800, Junio C Hamano wrote:
Show 8 quoted lines
> +			sym = find_ref_by_name(refs, symref);
> +			if (!sym) {
> +				/*
> +				 * NEEDSWORK: perhaps create the symref ref
> +				 * that is still unborn and queue it?
> +				 */
> +				continue;
> +			}

I don't see any reason not to create the pointer to an unborn branch. I think it would be nice eventually to allow cloning an empty repository (i.e., to facilitate:

  mkdir foo &&
  (cd foo && git --bare init) &&
  git clone foo bar &&
  cd bar &&
  echo content >file && git add file && git commit -m content &&
  git push
) which people have asked for from time to time.
> +			if (sym->symref)
> +				die("symref line says %s points at %s "
> +				    "but earlier it said it points at %s",
> +				    symref, target, sym->symref);

I wonder if there would ever be a use for sending multiple symref packets for the same ref. IOW, should we "be liberal in what we accept" here and just choose some sane behavior (like picking the first or last to be sent), and allow room for expansion there.

I can't actually think of a possible use for that, but nor can I think of any particular reason to die here (save for detecting bugs in upload-pack :) ). But just consider that we will be stuck with clients with the "die" behavior forever.

-Peff
Previous: Junio C HamanoNext: Jeff King
Message 9 of 11 in “clone: test the new HEAD detection logic”
  1. 5/5 clone: test the new HEAD detection logicJunio C Hamano, Nov 30, 2008
  2. 4/5 upload-pack: implement protocol extension "symbolic-ref"Junio C Hamano, Nov 30, 2008
  3. 3/5 clone: find the current branch more explicitlyJunio C Hamano, Nov 30, 2008
  4. 2/5 get_remote_heads(): do not assume that the conversation is one-wayJunio C Hamano, Nov 30, 2008
  5. 1/5 upload-pack.c: refactor receive_needs()Junio C Hamano, Nov 30, 2008
  6. 0/5 Detecting HEAD more reliably while cloningJunio C Hamano, Nov 30, 2008
  7. Junio C HamanoNov 30, 2008
  8. Junio C HamanoDec 1, 2008
  9. Jeff KingNov 30, 2008
  10. Jeff KingNov 30, 2008
  11. Junio C HamanoDec 1, 2008

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.