git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Rast <trast@inf.ethz.ch>
To: <git@vger.kernel.org>
Subject: [PATCH 2/3] remote: check for superfluous arguments in 'git remote add'
Date: Wed, 24 Apr 2013 15:54:36 +0200	[thread overview]
Message-ID: <f1da9b0de420a56313760847b580ee40e2c75b0b.1366811347.git.trast@inf.ethz.ch> (raw)
In-Reply-To: <cover.1366811347.git.trast@inf.ethz.ch>

The 'git remote add' subcommand did not check for superfluous command
line arguments.  Make it so.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
---
 builtin/remote.c  | 2 +-
 t/t5505-remote.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/remote.c b/builtin/remote.c
index 937484d..5e54d36 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -178,7 +178,7 @@ static int add(int argc, const char **argv)
 	argc = parse_options(argc, argv, NULL, options, builtin_remote_add_usage,
 			     0);
 
-	if (argc < 2)
+	if (argc != 2)
 		usage_with_options(builtin_remote_add_usage, options);
 
 	if (mirror && master)
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 764ee97..eea87fc 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -1020,7 +1020,7 @@ test_extra_arg () {
 	"
 }
 
-test_extra_arg -f add nick url
+test_extra_arg add nick url
 test_extra_arg rename origin newname
 test_extra_arg remove origin
 test_extra_arg set-head origin master
-- 
1.8.2.1.931.g0116868

  parent reply	other threads:[~2013-04-24 13:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24 13:54 [PATCH 0/3] git remote with superfluous arguments Thomas Rast
2013-04-24 13:54 ` [PATCH 1/3] remote: add a test for extra arguments, according to docs Thomas Rast
2013-04-24 21:37   ` Junio C Hamano
2013-04-25  7:23     ` Thomas Rast
2013-04-25 15:31       ` Junio C Hamano
2013-04-24 13:54 ` Thomas Rast [this message]
2013-04-24 13:54 ` [PATCH 3/3] remote: 'show' and 'prune' take more than one remote Thomas Rast

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=f1da9b0de420a56313760847b580ee40e2c75b0b.1366811347.git.trast@inf.ethz.ch \
    --to=trast@inf.ethz.ch \
    --cc=git@vger.kernel.org \
    /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).