diff mbox series

[1/1] do_git_config_sequence(): fall back to git_dir if commondir is NULL

Message ID a3854e4ed8108c8fde5cd4e2107e90ccffafd49b.1542121541.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Some left-over add-on for bw/config-h | expand

Commit Message

Johannes Schindelin via GitGitGadget Nov. 13, 2018, 3:05 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

Just some defensive programming.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 config.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/config.c b/config.c
index 4051e38823..279d0d7077 100644
--- a/config.c
+++ b/config.c
@@ -1676,6 +1676,8 @@  static int do_git_config_sequence(const struct config_options *opts,
 
 	if (opts->commondir)
 		repo_config = mkpathdup("%s/config", opts->commondir);
+	else if (opts->git_dir)
+		repo_config = mkpathdup("%s/config", opts->git_dir);
 	else
 		repo_config = NULL;