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

Re: [PATCH] builtin/init-db: handle bare clones when core.bare set to false

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Mar 8, 2021, 23:22 UTC
Message-ID
<YEaxomZIluLVRWEr@camp.crustytoothpaste.net>
In-Reply-To
<CAPig+cRoZPg96aSgPoswYf-fz1_1Hxc1NfAER0kUB8Hy00WB9Q@mail.gmail.com>
On 2021-03-08 at 16:43:58, Eric Sunshine wrote:
Show 16 quoted lines
> On Mon, Mar 8, 2021 at 8:18 AM brian m. carlson
> <sandals@crustytoothpaste.net> wrote:
> > In 552955ed7f ("clone: use more conventional config/option layering",
> > 2020-10-01), clone learned to read configuration options earlier in its
> > execution, before creating the new repository.  However, that led to a
> > problem: if the core.bare setting is set to false in the global config,
> > cloning a bare repository segfaults.  This happens because the
> > repository is falsely thought to be non-bare, but clone has set the work
> > tree to NULL, which is then dereferenced.
> > [...]
> > Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
> > ---
> 
> Perhaps this deserves a:
> 
>     Reported-by: Joseph Vusich <jvusich@amazon.com>
Good point.  Will fix.
Show 15 quoted lines
> > diff --git a/t/t5606-clone-options.sh b/t/t5606-clone-options.sh
> > @@ -104,6 +104,13 @@ test_expect_success 'redirected clone -v does show progress' '
> > +test_expect_success 'clone does not segfault with --bare and core.bare=false' '
> > +       test_config_global core.bare false &&
> > +       git clone --bare "file://$(pwd)/parent" clone-bare &&
> 
> Can this be done more simply as:
> 
>     git clone --bare parent clone-bare &&
> 
> or even:
> 
>     git clone --bare . clone-bare &&
> 
> without mucking about with $(pwd)?
Sure.  I pulled the line from the test above, but I agree that's nicer.
Show 10 quoted lines
> > +       git -C clone-bare rev-parse --is-bare-repository >is-bare &&
> > +       test "$(cat is-bare)" = true
> 
> These days, we'd probably say:
> 
>     echo true >expect &&
>     git -C clone-bare rev-parse --is-bare-repository >actual &&
>     test_cmp expect actual
> 
> but it's subjective and minor; not at all worth a re-roll.
There's enough nits to warrant a v2, so I can do one.
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Eric SunshineNext: brian m. carlson
Message 7 of 10 in “bug: conflicting core.bare setting causes segfault during bare clone”
  1. Vusich, JosephMar 3, 2021
  2. brian m. carlsonMar 3, 2021
  3. Junio C HamanoMar 4, 2021
  4. Vusich, JosephMar 4, 2021
  5. builtin/init-db: handle bare clones when core.bare set to falsebrian m. carlson, Mar 8, 2021
  6. Eric SunshineMar 8, 2021
  7. brian m. carlsonMar 8, 2021
  8. builtin/init-db: handle bare clones when core.bare set to falsebrian m. carlson, Mar 10, 2021
  9. Junio C HamanoMar 10, 2021
  10. brian m. carlsonMar 10, 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.