Skip to content

Commit

Permalink
clone: detect extra arguments
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Oct 30, 2009
1 parent ebc9d42 commit d52dc4b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion builtin-clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d52dc4b

Please sign in to comment.