Re: git init BUG when gitconfig has includeIf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx> 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: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux