diff mbox series

[v2,1/1] config: report a bug if git_dir exists without commondir

Message ID 0767f9837811c922c49c5aa148252f9e66320f18.1542203938.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

Bruce Perry via GitGitGadget Nov. 14, 2018, 1:59 p.m. UTC
From: Johannes Schindelin <johannes.schindelin@gmx.de>

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>
---
 config.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Jeff King Nov. 14, 2018, 9:42 p.m. UTC | #1
On Wed, Nov 14, 2018 at 05:59:02AM -0800, Johannes Schindelin via GitGitGadget wrote:

> From: Johannes Schindelin <johannes.schindelin@gmx.de>
> 
> 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>
> ---
>  config.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/config.c b/config.c
> index 4051e38823..db6b0167c6 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)
> +		BUG("git_dir without commondir");

Yeah, I think this is the right thing to do. Thanks!

-Peff
diff mbox series

Patch

diff --git a/config.c b/config.c
index 4051e38823..db6b0167c6 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)
+		BUG("git_dir without commondir");
 	else
 		repo_config = NULL;