Skip to content

Commit d212ca1

Browse files
felipecgitster
authored andcommitted
git config: error when editing a repo config and not being in one
Let's throw an error on this specific case. If the user specifies the config file, he must know what he is doing. Teemu Likonen pointed this out. Signed-off-by: Felipe Contreras <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2163e3f commit d212ca1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin-config.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
390390
}
391391
else if (actions == ACTION_EDIT) {
392392
check_argc(argc, 0, 0);
393+
if (!config_exclusive_filename && nongit)
394+
die("not in a git directory");
393395
git_config(git_default_config, NULL);
394396
launch_editor(config_exclusive_filename ?
395397
config_exclusive_filename : git_path("config"),

0 commit comments

Comments
 (0)