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

Re: [PATCH] clone: handle unborn branch in bare repos

From
Taylor Blau <me@ttaylorr.com>
Date
Sep 20, 2021, 20:28 UTC
Message-ID
<YUju1gmT1nDh1PLv@nand.local>
In-Reply-To
<YUjbKt0Hw0ieHcaN@coredump.intra.peff.net>
On Mon, Sep 20, 2021 at 03:04:10PM -0400, Jeff King wrote:
Show 17 quoted lines
> When cloning a repository with an unborn HEAD, we'll set the local HEAD
> to match it only if the local repository is non-bare. This is
> inconsistent with all other combinations:
>
>   remote HEAD       | local repo | local HEAD
>   -----------------------------------------------
>   points to commit  | non-bare   | same as remote
>   points to commit  | bare       | same as remote
>   unborn            | non-bare   | same as remote
>   unborn            | bare       | local default
>
> So I don't think this is some clever or subtle behavior, but just a bug
> in 4f37d45706 (clone: respect remote unborn HEAD, 2021-02-05). And it's
> easy to see how we ended up there. Before that commit, the code to set
> up the HEAD for an empty repo was guarded by "if (!option_bare)". That's
> because the only thing it did was call install_branch_config(), and we
> don't want to do so for a bare repository (unborn HEAD or not).

Readding this and 4f37d45706, I tend to agree. Thanks for a straightforward patch, fix, and test :-).

    Reviewed-by: Taylor Blau <me@ttaylorr.com>

Thanks, Taylor

Previous: Jonathan Tan
Message 3 of 3 in “clone: handle unborn branch in bare repos”
  1. clone: handle unborn branch in bare reposJeff King, Sep 20, 2021
  2. Jonathan TanSep 20, 2021
  3. Taylor BlauSep 20, 2021

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.