To refactor read_early_config() so that it discovers .git/config properly, we have to make certain that commands such as `git init` (i.e. commands that create their own .git/ and therefore do *not* want to be affected by any other .git/ directory) skip this discovery. Let's introduce a flag that states for every builtin whether it creates its own .git/ directory or not. Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- git.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/git.c b/git.c index dce529fcbf..61df78afc8 100644 --- a/git.c +++ b/git.c @@ -318,12 +318,13 @@ static int handle_alias(int *argcp, const char ***argv) #define RUN_SETUP (1<<0) #define RUN_SETUP_GENTLY (1<<1) #define USE_PAGER (1<<2) +#define CREATES_GIT_DIR (1<<3) /* * require working tree to be present -- anything uses this needs * RUN_SETUP for reading from the configuration file. */ -#define NEED_WORK_TREE (1<<3) -#define SUPPORT_SUPER_PREFIX (1<<4) +#define NEED_WORK_TREE (1<<4) +#define SUPPORT_SUPER_PREFIX (1<<5) struct cmd_struct { const char *cmd; @@ -412,7 +413,7 @@ static struct cmd_struct commands[] = { { "cherry", cmd_cherry, RUN_SETUP }, { "cherry-pick", cmd_cherry_pick, RUN_SETUP | NEED_WORK_TREE }, { "clean", cmd_clean, RUN_SETUP | NEED_WORK_TREE }, - { "clone", cmd_clone }, + { "clone", cmd_clone, CREATES_GIT_DIR }, { "column", cmd_column, RUN_SETUP_GENTLY }, { "commit", cmd_commit, RUN_SETUP | NEED_WORK_TREE }, { "commit-tree", cmd_commit_tree, RUN_SETUP }, @@ -438,7 +439,7 @@ static struct cmd_struct commands[] = { { "hash-object", cmd_hash_object }, { "help", cmd_help }, { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY }, - { "init", cmd_init_db }, + { "init", cmd_init_db, CREATES_GIT_DIR }, { "init-db", cmd_init_db }, { "interpret-trailers", cmd_interpret_trailers, RUN_SETUP_GENTLY }, { "log", cmd_log, RUN_SETUP }, -- 2.11.0.rc3.windows.1