git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git config: error when editing a repo config and not being in one
@ 2009-04-29 22:25 Felipe Contreras
  2009-04-29 22:44 ` Johannes Schindelin
  2009-04-29 23:01 ` Junio C Hamano
  0 siblings, 2 replies; 8+ messages in thread
From: Felipe Contreras @ 2009-04-29 22:25 UTC (permalink / raw)
  To: git; +Cc: Teemu Likonen, Junio C Hamano, Johannes Schindelin,
	Felipe Contreras

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>
---
 builtin-config.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/builtin-config.c b/builtin-config.c
index d8da72c..6e936e1 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -390,6 +390,8 @@ int cmd_config(int argc, const char **argv, const char *unused_prefix)
 	}
 	else if (actions == ACTION_EDIT) {
 		check_argc(argc, 0, 0);
+		if (!config_exclusive_filename && !is_inside_git_dir())
+			die("not in a git directory");
 		git_config(git_default_config, NULL);
 		launch_editor(config_exclusive_filename ?
 			      config_exclusive_filename : git_path("config"),
-- 
1.6.3.rc3.12.gb7937.dirty

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-04-30  9:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-29 22:25 [PATCH] git config: error when editing a repo config and not being in one Felipe Contreras
2009-04-29 22:44 ` Johannes Schindelin
2009-04-29 22:49   ` Felipe Contreras
2009-04-30  8:37     ` Johannes Schindelin
2009-04-30  9:11       ` Felipe Contreras
2009-04-30  9:21         ` Johannes Schindelin
2009-04-29 23:22   ` Junio C Hamano
2009-04-29 23:01 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).