summaryrefslogtreecommitdiff
path: root/builtin-clone.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2009-10-29 03:10:30 -0500
committerJunio C Hamano <gitster@pobox.com>2009-10-30 15:18:11 -0700
commitd52dc4b10b2f78dc24ea05e88ddc25ee0f46491e (patch)
tree7e2957739b1ea3df787185f13fcbd3ebf15054c2 /builtin-clone.c
parentebc9d420566de32dbadada5a4f700db2d974853c (diff)
downloadgit-d52dc4b10b2f78dc24ea05e88ddc25ee0f46491e.tar.gz
clone: detect extra arguments
If git clone is given more than two non-option arguments, it silently throws away all but the first one. Complain instead. Discovered by comparing the new builtin clone to the old git-clone.sh. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-clone.c')
-rw-r--r--builtin-clone.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/builtin-clone.c b/builtin-clone.c
index 0a4f6124f5..caf3025031 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -379,8 +379,13 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
argc = parse_options(argc, argv, prefix, builtin_clone_options,
builtin_clone_usage, 0);
+ if (argc > 2)
+ usage_msg_opt("Too many arguments.",
+ builtin_clone_usage, builtin_clone_options);
+
if (argc == 0)
- die("You must specify a repository to clone.");
+ usage_msg_opt("You must specify a repository to clone.",
+ builtin_clone_usage, builtin_clone_options);
if (option_mirror)
option_bare = 1;