Re: [PATCH v2] setup: fix bug with "includeIf.onbranch" when initializing dir

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

 



On Wed, May 22, 2024 at 05:43:32PM -0700, Junio C Hamano wrote:
[snip]
> diff --git a/setup.c b/setup.c
> index b69b1cbc2a..c6fffa0164 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -2224,6 +2213,21 @@ int init_db(const char *git_dir, const char *real_git_dir,
>  	repo_set_hash_algo(the_repository, repo_fmt.hash_algo);
>  	repo_set_ref_storage_format(the_repository, repo_fmt.ref_storage_format);
>  
> +	/*
> +	 * Ensure `core.hidedotfiles` is processed. This must happen after we
> +	 * have set up the repository format such that we can evaluate
> +	 * includeIf conditions correctly in the case of re-initialization.
> +	 */
> +	git_config(platform_core_config, NULL);
> +
> +	safe_create_dir(git_dir, 0);
> +
> +	prev_bare_repository = is_bare_repository();

Okay, `prev_bare_repository` is another difference between v2.44 and
master.

> +	reinit = create_default_files(template_dir, original_git_dir,
> +				      &repo_fmt, prev_bare_repository,
> +				      init_shared_repository);
> +
>  	if (!(flags & INIT_DB_SKIP_REFDB))
>  		create_reference_database(repo_fmt.ref_storage_format,
>  					  initial_branch, flags & INIT_DB_QUIET);
> diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> index b131d665db..319ed81631 100755
> --- a/t/t0001-init.sh
> +++ b/t/t0001-init.sh
> @@ -584,14 +584,39 @@ test_expect_success 'init with --ref-format=files' '
>  	test_cmp expect actual
>  '
>  
> -test_expect_success 're-init with same format' '
> -	test_when_finished "rm -rf refformat" &&
> -	git init --ref-format=files refformat &&
> -	git init --ref-format=files refformat &&
> -	echo files >expect &&
> -	git -C refformat rev-parse --show-ref-format >actual &&
> -	test_cmp expect actual
> -'
> +backends="files"
> +for from_format in $backends
> +do
> +	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
> +	'

And this here is the change to the test setup, which makes sense.

Looks sensible, thanks!

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