@matheusbsbs / matheus-bagliano / commits / d52dc4b10b
Fork 0

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>

Jonathan Nieder committed Oct 29, 2009 at 03:10 UTC d52dc4b10b2f78dc24ea05e88ddc25ee0f46491e
1 file changed +6 -1
builtin-clone.c
+6 -1
@@ -379,8 +379,13 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
379 argc = parse_options(argc, argv, prefix, builtin_clone_options,
380 builtin_clone_usage, 0);
381
382 + if (argc > 2)
383 + usage_msg_opt("Too many arguments.",
384 + builtin_clone_usage, builtin_clone_options);
385 +
386 if (argc == 0)
383 - die("You must specify a repository to clone.");
387 + usage_msg_opt("You must specify a repository to clone.",
388 + builtin_clone_usage, builtin_clone_options);
389
390 if (option_mirror)
391 option_bare = 1;