[PATCH] remote add: disallow --master and --mirror with non-bare repositories

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Johannes Schindelin
Date: Tuesday, April 22, 2008 - 10:23 am

In most cases, --master or --mirror in a non-bare repository is an
error.  In those cases where it is not, the user is most likely editing
the config herself anyway.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>

---

	On Tue, 22 Apr 2008, Junio C Hamano wrote:

	> I personally do not think --mirror option makes sense with 
	> --track, nor it makes sense in a non-bare repository for that matter.

	Obviously meant for application together with Peff's patch.

 builtin-remote.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/builtin-remote.c b/builtin-remote.c
index d4f2132..63f025c 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -79,6 +79,12 @@ static int add(int argc, const char **argv)
 
 	argc = parse_options(argc, argv, options, builtin_remote_usage, 0);
 
+	if (mirror && is_bare_repository())
+		die("--mirror with non-bare repository.");
+
+	if (master && is_bare_repository())
+		die("--master with non-bare repository.");
+
 	if (argc < 2)
 		usage_with_options(builtin_remote_usage, options);
 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: git remote update -&gt; rejected, Junio C Hamano, (Tue Apr 22, 9:50 am)
[PATCH] remote add: disallow --master and --mirror with no ..., Johannes Schindelin, (Tue Apr 22, 10:23 am)
Re: [PATCH] remote add: disallow --master and --mirror wit ..., Johannes Schindelin, (Tue Apr 22, 3:04 pm)