From: Kevin Ballard Date: Sat, 5 Apr 2008 18:28:53 +0000 (-0400) Subject: git-fetch: Don't trigger a bus error when given the refspec "tag" X-Git-Tag: v1.5.5~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f53423b0e09d0de9584f72ac298bdfdc9e886d73;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin-fetch.c b/builtin-fetch.c index a11548c89..5841b3e51 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]);