git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: git@vger.kernel.org
Cc: Teemu Likonen <tlikonen@iki.fi>,
	Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH] git config: error when editing a repo config and not being in one
Date: Thu, 30 Apr 2009 01:25:39 +0300	[thread overview]
Message-ID: <1241043939-29013-1-git-send-email-felipe.contreras@gmail.com> (raw)

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

             reply	other threads:[~2009-04-29 22:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-29 22:25 Felipe Contreras [this message]
2009-04-29 22:44 ` [PATCH] git config: error when editing a repo config and not being in one 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1241043939-29013-1-git-send-email-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=tlikonen@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).