Skip to content

Commit f53423b

Browse files
lilyballgitster
authored andcommitted
git-fetch: Don't trigger a bus error when given the refspec "tag"
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>
1 parent 4ed4a34 commit f53423b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin-fetch.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,8 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
637637
if (!strcmp(argv[i], "tag")) {
638638
char *ref;
639639
i++;
640+
if (i >= argc)
641+
die("You need to specify a tag name.");
640642
ref = xmalloc(strlen(argv[i]) * 2 + 22);
641643
strcpy(ref, "refs/tags/");
642644
strcat(ref, argv[i]);

0 commit comments

Comments
 (0)