diff options
| author | Junio C Hamano <gitster@pobox.com> | 2024-06-28 15:53:15 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-28 15:53:16 -0700 |
| commit | 6e3eb346edf9f9b701c916148a3cdd74505fdd11 (patch) | |
| tree | b26f442b8f499d1ed7e04faa540437b82aac62a6 /setup.c | |
| parent | 903b4da27fdf9dbcc8d2b59c846fcfa90882d6f3 (diff) | |
| parent | 407997c1ddbbedfda2eb7cdc5848781c96b37dc3 (diff) | |
| download | git-6e3eb346edf9f9b701c916148a3cdd74505fdd11.tar.xz | |
Merge branch 'ps/fix-reinit-includeif-onbranch' into maint-2.45
"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
@@ -2286,12 +2286,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 @@ -2302,9 +2296,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. @@ -2312,6 +2303,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); |
