@matheusbsbs / matheus-bagliano / commits / d212ca1724
Fork 0

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 <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Felipe Contreras committed Apr 30, 2009 at 01:49 UTC d212ca1724b1a3708a3b4cb72c58b20ef442b24f
1 file changed +2
builtin-config.c
+2
@@ -390,6 +390,8 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
390 }
391 else if (actions == ACTION_EDIT) {
392 check_argc(argc, 0, 0);
393 + if (!config_exclusive_filename && nongit)
394 + die("not in a git directory");
395 git_config(git_default_config, NULL);
396 launch_editor(config_exclusive_filename ?
397 config_exclusive_filename : git_path("config"),