git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Git List <git@vger.kernel.org>, jvusich@amazon.com
Subject: Re: [PATCH] builtin/init-db: handle bare clones when core.bare set to false
Date: Mon, 8 Mar 2021 23:22:10 +0000	[thread overview]
Message-ID: <YEaxomZIluLVRWEr@camp.crustytoothpaste.net> (raw)
In-Reply-To: <CAPig+cRoZPg96aSgPoswYf-fz1_1Hxc1NfAER0kUB8Hy00WB9Q@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1948 bytes --]

On 2021-03-08 at 16:43:58, Eric Sunshine wrote:
> 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.

> > 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.

> > +       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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  reply	other threads:[~2021-03-08 23:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-03  0:06 bug: conflicting core.bare setting causes segfault during bare clone Vusich, Joseph
2021-03-03 23:59 ` brian m. carlson
2021-03-04  1:13   ` Junio C Hamano
2021-03-04 11:48     ` Vusich, Joseph
2021-03-08 13:17 ` [PATCH] builtin/init-db: handle bare clones when core.bare set to false brian m. carlson
2021-03-08 16:43   ` Eric Sunshine
2021-03-08 23:22     ` brian m. carlson [this message]
2021-03-10  1:11 ` [PATCH v2] " brian m. carlson
2021-03-10 23:09   ` Junio C Hamano
2021-03-10 23:33     ` brian m. carlson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YEaxomZIluLVRWEr@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=git@vger.kernel.org \
    --cc=jvusich@amazon.com \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).