From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Heghedus Razvan <heghedus.razvan@protonmail.com>
Subject: Re: [PATCH] setup: fix bug with "includeIf.onbranch" when initializing dir
Date: Thu, 23 May 2024 07:26:18 +0200 [thread overview]
Message-ID: <Zk7Tej-AII3Ge6Ge@tanuki> (raw)
In-Reply-To: <xmqq4jap1hs7.fsf@gitster.g>
[-- Attachment #1: Type: text/plain, Size: 2347 bytes --]
On Wed, May 22, 2024 at 05:41:28PM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
[snip]
> > +for from_format in files reftable
> > +do
> > + for to_format in files reftable
> > + do
> > + if test "$from_format" = "$to_format"
> > + then
> > + continue
> > + fi
> > +
> > + test_expect_success "re-init with same format ($from_format)" '
> > + test_when_finished "rm -rf refformat" &&
> > + git init --ref-format=$from_format refformat &&
> > + git init --ref-format=$from_format refformat &&
> > + echo $from_format >expect &&
> > + git -C refformat rev-parse --show-ref-format >actual &&
> > + test_cmp expect actual
> > + '
>
> This is very iffy, isn't it? This one wants to do the same format
> reinit, but it is behind "if from and to are the same, skip the rest"
> in the loop.
>
> I think the "same format" loop should be lifted outside and
> immediately before the inner loop and we should be OK.
Yup, we can do that.
> > + test_expect_success "re-init with different format fails ($from_format -> $to_format)" '
> > + test_when_finished "rm -rf refformat" &&
> > + git init --ref-format=$from_format refformat &&
> > + cat >expect <<-EOF &&
> > + fatal: attempt to reinitialize repository with different reference storage format
> > + EOF
> > + test_must_fail git init --ref-format=$to_format refformat 2>err &&
> > + test_cmp expect err &&
> > + echo $from_format >expect &&
> > + git -C refformat rev-parse --show-ref-format >actual &&
> > + test_cmp expect actual
> > + '
> > + done
> > +done
>
> In any case, this "reinitialize to a different format is too late"
> test has nothing to do with the problem we are fixing with this
> patch, no? It is a valuable set of tests in the post b4385bf0 world
> where we can choose between the two, but it is somewhat out of scope
> of the "we need to initialize the ref backend before we can do onbranch
> config".
>
> I'll send your patch backported to v2.44.0, plus the change needed
> to review the merge of it into v2.45.0 codebase later.
Yeah, I wanted to play it safe and add some cases I felt were missing in
the existing test coverage so that there ideally aren't any other issues
and so that the proposed change doesn't regress functionality.
Patrick
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2024-05-23 5:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 7:54 git init BUG when gitconfig has includeIf Heghedus Razvan
2024-05-21 16:36 ` Junio C Hamano
2024-05-21 16:46 ` Heghedus Razvan
2024-05-22 8:06 ` Patrick Steinhardt
2024-05-22 8:21 ` Heghedus Razvan
2024-05-22 8:27 ` Patrick Steinhardt
2024-05-22 10:38 ` [PATCH] setup: fix bug with "includeIf.onbranch" when initializing dir Patrick Steinhardt
2024-05-22 10:58 ` Heghedus Razvan
2024-05-22 19:06 ` Junio C Hamano
2024-05-23 0:41 ` Junio C Hamano
2024-05-23 5:26 ` Patrick Steinhardt [this message]
2024-05-23 0:43 ` [PATCH v2] " Junio C Hamano
2024-05-23 0:56 ` [rPATCH " Junio C Hamano
2024-05-23 5:26 ` [PATCH " Patrick Steinhardt
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=Zk7Tej-AII3Ge6Ge@tanuki \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=heghedus.razvan@protonmail.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.
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.