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

[FUN PATCH] Remove "git clone" parameters if they are the first in a git clone call

From
PBPieter de Bie <pdebie@ai.rug.nl>
Date
Jul 30, 2008, 23:02 UTC
Message-ID
<1217458929-84974-1-git-send-email-pdebie@ai.rug.nl>

This removes accidental duplicate "git clone" parameters, for example when typing:

  git clone git clone git://repo.or.cz/git.git
---

OK, so it happens often to me that I copy a line that already starts with "git clone", and then type it myself again, paste, and hit enter. I thought it might happen to others too, hence this patch.

 builtin-clone.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/builtin-clone.c b/builtin-clone.c
index 4b1ab36..9e4c7c2 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -350,6 +350,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
 	junk_pid = getpid();
 
+	if (argc > 3 && !strcmp(argv[1], "git") && !strcmp(argv[2], "clone")) {
+		argv += 2;
+		argc -= 2;
+	}
+
 	argc = parse_options(argc, argv, builtin_clone_options,
 			     builtin_clone_usage, 0);
 
-- 
1.6.0.rc1.163.g8ec19
Message 1 of 1 in “Remove "git clone" parameters if they are the first in a git clone call”
  1. Remove "git clone" parameters if they are the first in a git clone callPieter de Bie, Jul 30, 2008

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.