Re: [PATCH] Keep "git --git-dir" from causing a bus error.
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Dec 22, 2006, 16:08 UTC
- Message-ID
- <Pine.LNX.4.63.0612221708070.19693@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <20061222135625.GA26084@179.242.249.10.in-addr.arpa>
Hi,
On Fri, 22 Dec 2006, Brian Gernhardt wrote:
Show 16 quoted lines
> diff --git a/git.c b/git.c
> index 73cf4d4..2b3c9f9 100644
> --- a/git.c
> +++ b/git.c
> @@ -59,11 +59,14 @@ static int handle_options(const char*** argv, int* argc)
> } else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
> setup_pager();
> } else if (!strcmp(cmd, "--git-dir")) {
> - if (*argc < 1)
> - return -1;
> - setenv("GIT_DIR", (*argv)[1], 1);
> - (*argv)++;
> - (*argc)--;
> + if (*argc < 2) {
> + fprintf(stderr, "No directory given for --git-dir.\n" );
> + usage(git_usage_string);Usage already exits, so you do not need this:
> + } else {Ciao, Dscho