All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
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 11:43:58 -0500	[thread overview]
Message-ID: <CAPig+cRoZPg96aSgPoswYf-fz1_1Hxc1NfAER0kUB8Hy00WB9Q@mail.gmail.com> (raw)
In-Reply-To: <20210308131718.546055-1-sandals@crustytoothpaste.net>

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>

> 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)?

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

  reply	other threads:[~2021-03-08 16:45 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 [this message]
2021-03-08 23:22     ` brian m. carlson
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

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

  git send-email \
    --in-reply-to=CAPig+cRoZPg96aSgPoswYf-fz1_1Hxc1NfAER0kUB8Hy00WB9Q@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=jvusich@amazon.com \
    --cc=sandals@crustytoothpaste.net \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.