All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Heghedus Razvan <heghedus.razvan@protonmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: git init BUG when gitconfig has includeIf
Date: Wed, 22 May 2024 10:27:31 +0200	[thread overview]
Message-ID: <Zk2sc-649Pz77_G-@tanuki> (raw)
In-Reply-To: <D1G108TQBWK4.2XW34J29NCAHG@protonmail.com>

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

On Wed, May 22, 2024 at 08:21:50AM +0000, Heghedus Razvan wrote:
> On Wed May 22, 2024 at 11:06 AM EEST, Patrick Steinhardt wrote:
> > On Tue, May 21, 2024 at 04:46:23PM +0000, Heghedus Razvan wrote:
> > > On Tue May 21, 2024 at 7:36 PM EEST, Junio C Hamano wrote:
> > > > Heghedus Razvan <heghedus.razvan@protonmail.com> writes:
> > Aha! Seems like this only happens when re-initializing an already
> > existent repository, that's what's missing. In that case we do already
> > have `the_repository->gitdir` set even though we did not yet set up the
> > ref storage format. I'll investigate and send a patch.
> >
> > Can you confirm that this is what you see, or do you also see this when
> > creating an entirely new repository?
> 
> Hi Patrick,
> 
> Thanks for looking into this. It seems that the issue happens only when
> the folder for the repo exists.
> 
> Eg:
> $ mkdir new_folder
> $ cd new_folder
> $ git init . 
> 
> or
> $ mkdir new_folder
> $ git init new_folder
> 
> But directly running `git init new_folder` when there is no `new_folder`
> works fine.
> 
> FYI, I just did these tests on master (4365c6fcf9).
> 
> Regards,
> Razvan

Indeed, thanks for clarifying. From the following three tests, the
latter two fail:

diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index b131d665db..c1c7c307d3 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -678,4 +678,21 @@ test_expect_success 'branch -m with the initial branch' '
    test_cmp expect actual
 '
 
+test_expect_success 'init with includeIf.onbranch condition' '
+	test_when_finished "rm -rf repo" &&
+	git -c includeIf.onbranch:main.path=something init repo
+'
+
+test_expect_success 'init with includeIf.onbranch condition with existing directory' '
+	test_when_finished "rm -rf repo" &&
+	mkdir repo &&
+	git -c includeIf.onbranch:main.path=something init repo
+'
+
+test_expect_success 're-init with includeIf.onbranch condition' '
+	test_when_finished "rm -rf repo" &&
+	git init repo &&
+	git -c includeIf.onbranch:main.path=something init repo
+'
+
 test_done

I've got a fix ready that I'll send upstream later today.

Patrick

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

  reply	other threads:[~2024-05-22  8:27 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 [this message]
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
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=Zk2sc-649Pz77_G-@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.