diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-09-21 15:15:23 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-09-21 15:15:24 -0700 |
commit | d845d727cb1935202b61a3b7b6c8cfa7c09bd204 (patch) | |
tree | 7296be39100177a980c2e3d5700371f11dd5b03d /builtin/init-db.c | |
parent | Merge branch 'ew/http-do-not-forget-to-call-curl-multi-remove-handle' (diff) | |
parent | t1007: factor out repeated setup (diff) | |
download | tgif-d845d727cb1935202b61a3b7b6c8cfa7c09bd204.tar.xz |
Merge branch 'jk/setup-sequence-update'
There were numerous corner cases in which the configuration files
are read and used or not read at all depending on the directory a
Git command was run, leading to inconsistent behaviour. The code
to set-up repository access at the beginning of a Git process has
been updated to fix them.
* jk/setup-sequence-update:
t1007: factor out repeated setup
init: reset cached config when entering new repo
init: expand comments explaining config trickery
config: only read .git/config from configured repos
test-config: setup git directory
t1302: use "git -C"
pager: handle early config
pager: use callbacks instead of configset
pager: make pager_program a file-local static
pager: stop loading git_default_config()
pager: remove obsolete comment
diff: always try to set up the repository
diff: handle --no-index prefixes consistently
diff: skip implicit no-index check when given --no-index
patch-id: use RUN_SETUP_GENTLY
hash-object: always try to set up the git repository
Diffstat (limited to 'builtin/init-db.c')
-rw-r--r-- | builtin/init-db.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/builtin/init-db.c b/builtin/init-db.c index 80192f65e4..72e81447ae 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -185,16 +185,25 @@ static int create_default_files(const char *template_path) /* Just look for `init.templatedir` */ git_config(git_init_db_config, NULL); - /* First copy the templates -- we might have the default + /* + * First copy the templates -- we might have the default * config file there, in which case we would want to read * from it after installing. + * + * Before reading that config, we also need to clear out any cached + * values (since we've just potentially changed what's available on + * disk). */ copy_templates(template_path); - + git_config_clear(); + reset_shared_repository(); git_config(git_default_config, NULL); - is_bare_repository_cfg = init_is_bare_repository; - /* reading existing config may have overwrote it */ + /* + * We must make sure command-line options continue to override any + * values we might have just re-read from the config. + */ + is_bare_repository_cfg = init_is_bare_repository; if (init_shared_repository != -1) set_shared_repository(init_shared_repository); |