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