diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-03-17 13:50:28 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-03-17 13:50:28 -0700 |
commit | a0393a298fecff8cdc17aba51245f29433520d81 (patch) | |
tree | a6491d24988a63b067193fc852902ae41933b00d /t/helper | |
parent | Merge branch 'bc/sha1-header-selection-with-cpp-macros' (diff) | |
parent | setup.c: mention unresolved problems (diff) | |
download | tgif-a0393a298fecff8cdc17aba51245f29433520d81.tar.xz |
Merge branch 'js/early-config'
The start-up sequence of "git" needs to figure out some configured
settings before it finds and set itself up in the location of the
repository and was quite messy due to its "chicken-and-egg" nature.
The code has been restructured.
* js/early-config:
setup.c: mention unresolved problems
t1309: document cases where we would want early config not to die()
setup_git_directory_gently_1(): avoid die()ing
t1309: test read_early_config()
read_early_config(): really discover .git/
read_early_config(): avoid .git/config hack when unneeded
setup: make read_early_config() reusable
setup: introduce the discover_git_directory() function
setup_git_directory_1(): avoid changing global state
setup: prepare setup_discovered_git_dir() for the root directory
setup_git_directory(): use is_dir_sep() helper
t7006: replace dubious test
Diffstat (limited to 't/helper')
-rw-r--r-- | t/helper/test-config.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/t/helper/test-config.c b/t/helper/test-config.c index 83a4f2ab86..8e3ed6a76c 100644 --- a/t/helper/test-config.c +++ b/t/helper/test-config.c @@ -66,6 +66,16 @@ static int iterate_cb(const char *var, const char *value, void *data) return 0; } +static int early_config_cb(const char *var, const char *value, void *vdata) +{ + const char *key = vdata; + + if (!strcmp(key, var)) + printf("%s\n", value); + + return 0; +} + int cmd_main(int argc, const char **argv) { int i, val; @@ -73,6 +83,11 @@ int cmd_main(int argc, const char **argv) const struct string_list *strptr; struct config_set cs; + if (argc == 3 && !strcmp(argv[1], "read_early_config")) { + read_early_config(early_config_cb, (void *)argv[2]); + return 0; + } + setup_git_directory(); git_configset_init(&cs); |