config: report a bug if git_dir exists without commondir
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 14 Nov 2018 13:59:02 +0000 (05:59 -0800)
committerJunio C Hamano <gitster@pobox.com>
Fri, 16 Nov 2018 02:54:01 +0000 (11:54 +0900)
This did happen at some stage, and was fixed relatively quickly. Make
sure that we detect very quickly, too, should that happen again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
config.c
index 2ffd39c22006beaf8c4b0941d82183dd3b756955..04286f7717645c6812c7236a282c34f5ad353eb7 100644 (file)
--- a/config.c
+++ b/config.c
@@ -1668,6 +1668,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)
+               BUG("git_dir without commondir");
        else
                repo_config = NULL;