git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Patrick Steinhardt <ps@pks.im>
Date
May 23, 2024, 05:26 UTC
Message-ID
<Zk7TdDRFAuwQMBHy@tanuki>
In-Reply-To
<xmqqwmnlz7bf.fsf_-_@gitster.g>

On Wed, May 22, 2024 at 05:43:32PM -0700, Junio C Hamano wrote: [snip]

Show 18 quoted lines
> 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.

Show 34 quoted lines
> +	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
Previous: Junio C Hamano
Message 14 of 14 in “git init BUG when gitconfig has includeIf”
  1. Heghedus RazvanMay 21, 2024
  2. Junio C HamanoMay 21, 2024
  3. Heghedus RazvanMay 21, 2024
  4. Patrick SteinhardtMay 22, 2024
  5. Heghedus RazvanMay 22, 2024
  6. Patrick SteinhardtMay 22, 2024
  7. setup: fix bug with "includeIf.onbranch" when initializing dirPatrick Steinhardt, May 22, 2024
  8. Heghedus RazvanMay 22, 2024
  9. Junio C HamanoMay 22, 2024
  10. Junio C HamanoMay 23, 2024
  11. Patrick SteinhardtMay 23, 2024
  12. setup: fix bug with "includeIf.onbranch" when initializing dirJunio C Hamano, May 23, 2024
  13. [rPATCH v2] setup: fix bug with "includeIf.onbranch" when initializing dirJunio C Hamano, May 23, 2024
  14. Patrick SteinhardtMay 23, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.