Subject: Re: [PATCH 2/3] t0001: work around the bug that reads config file before repo setup

From: Junio C Hamano <[email-masked]>
Date: Thu, 08 Sep 2016 12:44:30 -0700

Nguyễn Thái Ngọc Duy  <[email-masked]> writes:

> git-init somehow reads '.git/config' at current directory and sets
> log_all_ref_updates based on this file. Because log_all_ref_updates is
> not unspecified (-1) any more. It will not be written to the new repo's
> config file (see create_default_files() function).

I vaguely recall this was discussed recently somewhere.  Is this
related to <[email-masked]>?

> This will affect our tests in the next patch as we will compare the
> config file and expect that core.logallrefupdates is already set to true
> by "git init main-worktree".

Ugh.  The "mv" workaround is fine to demonstrate that you have fixed
one of two problems, but as you said, it would be nice to have another
that expects failure until both of them gets fixed.

> Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
> ---
>  t/t0001-init.sh | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> index d64e5e3..393c940 100755
> --- a/t/t0001-init.sh
> +++ b/t/t0001-init.sh
> @@ -385,7 +385,9 @@ test_expect_success MINGW 'bare git dir not hidden' '
>  '
>  
>  test_expect_success 're-init from a linked worktree' '
> +	mv .git/config work-around-init-reading-wrong-file &&
>  	git init main-worktree &&
> +	mv work-around-init-reading-wrong-file .git/config &&
>  	(
>  		cd main-worktree &&
>  		test_commit first &&