Re: [PATCH] git-fetch: Don't trigger a bus error when given the refspec "tag"
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 5, 2008, 18:33 UTC
- Message-ID
- <alpine.DEB.1.00.0804051931480.12583@eeepc-johanness>
- In-Reply-To
- <1207420133-23631-1-git-send-email-kevin@sb.org>
Hi,
On Sat, 5 Apr 2008, Kevin Ballard wrote:
Show 10 quoted lines
> 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.");Would it not be better to check in the if() above? IOW
if (i + 1 < argc && !strcmp(argv[i], "tag")) {Hmm?
Ciao, Dscho