diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-06-03 13:11:11 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-03 13:11:11 -0700 |
| commit | 5c7c063c1f2b862d4d91b2230fc064dd9cf2d414 (patch) | |
| tree | a9d454a2eb720a891c6f026260ce0c05d531c6c3 /setup.c | |
| parent | 9eaef5822cd76bbeb53b6479ce0ddaad34ee2b14 (diff) | |
| parent | 407997c1ddbbedfda2eb7cdc5848781c96b37dc3 (diff) | |
| download | git-5c7c063c1f2b862d4d91b2230fc064dd9cf2d414.tar.gz | |
Merge branch 'ps/fix-reinit-includeif-onbranch'
"git init" in an already created directory, when the user
configuration has includeif.onbranch, started to fail recently,
which has been corrected.
* ps/fix-reinit-includeif-onbranch:
setup: fix bug with "includeIf.onbranch" when initializing dir
Diffstat (limited to 'setup.c')
| -rw-r--r-- | setup.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -2342,12 +2342,6 @@ int init_db(const char *git_dir, const char *real_git_dir, } startup_info->have_repository = 1; - /* Ensure `core.hidedotfiles` is processed */ - git_config(platform_core_config, NULL); - - safe_create_dir(git_dir, 0); - - /* Check to see if the repository version is right. * Note that a newly created repository does not have * config file, so this will not fail. What we are catching @@ -2358,9 +2352,6 @@ int init_db(const char *git_dir, const char *real_git_dir, validate_hash_algorithm(&repo_fmt, hash); validate_ref_storage_format(&repo_fmt, ref_storage_format); - reinit = create_default_files(template_dir, original_git_dir, - &repo_fmt, init_shared_repository); - /* * Now that we have set up both the hash algorithm and the ref storage * format we can update the repository's settings accordingly. @@ -2368,6 +2359,18 @@ 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); + + reinit = create_default_files(template_dir, original_git_dir, + &repo_fmt, init_shared_repository); + if (!(flags & INIT_DB_SKIP_REFDB)) create_reference_database(repo_fmt.ref_storage_format, initial_branch, flags & INIT_DB_QUIET); |
