Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Teemu Likonen <tlikonen@iki.fi>, Jeff King <peff@peff.net>,
	Mike Galbraith <efault@gmx.de>, git <git@vger.kernel.org>
Subject: [PATCH] remote add: disallow --master and --mirror with non-bare repositories
Date: Tue, 22 Apr 2008 18:23:45 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0804221823010.4460@eeepc-johanness> (raw)
In-Reply-To: <7vd4ohzvda.fsf@gitster.siamese.dyndns.org>


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);
 

  reply	other threads:[~2008-04-22 17:24 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-22  9:48 git remote update -> rejected Mike Galbraith
2008-04-22 10:34 ` Jeff King
2008-04-22 10:55   ` Mike Galbraith
2008-04-22 11:11     ` Jeff King
2008-04-22 11:58       ` Johannes Schindelin
2008-04-22 12:56         ` Jeff King
2008-04-22 13:03           ` Johannes Schindelin
2008-04-22 13:09             ` Jeff King
2008-04-22 13:26               ` [PATCH] builtin-remote: resurrect forced updates to tracked branches Johannes Schindelin
2008-04-22 17:00         ` git remote update -> rejected Junio C Hamano
2008-04-22 12:41       ` Teemu Likonen
2008-04-22 12:56         ` Johannes Schindelin
2008-04-22 13:01           ` Jeff King
2008-04-22 13:05             ` Johannes Schindelin
2008-04-22 13:53               ` Paolo Bonzini
2008-04-22 13:39           ` Teemu Likonen
2008-04-22 13:49             ` Johannes Schindelin
2008-04-22 14:04               ` Teemu Likonen
2008-04-22 14:10                 ` Paolo Bonzini
2008-04-22 15:08                   ` Johannes Schindelin
2008-04-22 15:26                     ` Paolo Bonzini
2008-04-22 16:23                       ` Paolo Bonzini
2008-04-22 16:42                         ` Johannes Schindelin
2008-04-22 16:50           ` Junio C Hamano
2008-04-22 17:23             ` Johannes Schindelin [this message]
2008-04-22 18:45               ` [PATCH] remote add: disallow --master and --mirror with non-bare repositories Paolo Bonzini
2008-04-22 18:46               ` [PATCH] remote add: disallow --master and --mirror with non-bare repositories (review) Paolo Bonzini
2008-04-22 22:04                 ` Johannes Schindelin

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=alpine.DEB.1.00.0804221823010.4460@eeepc-johanness \
    --to=johannes.schindelin@gmx.de \
    --cc=efault@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --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