Skip to content

Commit

Permalink
git-fetch: Don't trigger a bus error when given the refspec "tag"
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Kevin Ballard authored and Junio C Hamano committed Apr 5, 2008
1 parent 4ed4a34 commit f53423b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin-fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit f53423b

Please sign in to comment.