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

[PATCH] git-fetch: Don't trigger a bus error when given the refspec "tag"

From
Kevin Ballard <kevin@sb.org>
Date
Apr 5, 2008, 18:28 UTC
Message-ID
<1207420133-23631-1-git-send-email-kevin@sb.org>

When git-fetch encounters the refspec "tag" it assumes that the next argument will be a tag name. If there is no next argument, it should die gracefully instead of erroring.

Signed-off-by: Kevin Ballard <kevin@sb.org>
---
 builtin-fetch.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-fetch.c b/builtin-fetch.c
index a11548c..5841b3e 100644
--- a/builtin-fetch.c
+++ b/builtin-fetch.c
@@ -637,6 +637,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 			if (!strcmp(argv[i], "tag")) {
 				char *ref;
 				i++;
+				if (i >= argc)
+					die("You need to specify a tag name.");
 				ref = xmalloc(strlen(argv[i]) * 2 + 22);
 				strcpy(ref, "refs/tags/");
 				strcat(ref, argv[i]);
-- 
1.5.5.rc3.dirty
Next: Johannes Schindelin
Message 1 of 3 in “git-fetch: Don't trigger a bus error when given the refspec "tag"”
  1. git-fetch: Don't trigger a bus error when given the refspec "tag"Kevin Ballard, Apr 5, 2008
  2. Johannes SchindelinApr 5, 2008
  3. Kevin BallardApr 5, 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.