git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] clone: detect extra arguments

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 29, 2009, 08:10 UTC
Message-ID
<20091029081030.GA11213@progeny.tock>

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>
---
 builtin-clone.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-clone.c b/builtin-clone.c
index 5762a6f..76ad581 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -377,6 +377,9 @@ 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)
+		die("Too many arguments.");
+
 	if (argc == 0)
 		die("You must specify a repository to clone.");
 
-- 
1.6.5.2
Next: Jeff King
Message 1 of 6 in “clone: detect extra arguments”
  1. clone: detect extra argumentsJonathan Nieder, Oct 29, 2009
  2. Jeff KingOct 29, 2009
  3. Jonathan NiederOct 30, 2009
  4. Jeff KingOct 30, 2009
  5. Jeff KingOct 30, 2009
  6. Johan HerlandOct 31, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.