git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

Previous: Brian GernhardtNext: Brian Gernhardt
Message 2 of 3 in “Keep "git --git-dir" from causing a bus error.”
  1. Keep "git --git-dir" from causing a bus error.Brian Gernhardt, Dec 22, 2006
  2. Johannes SchindelinDec 22, 2006
  3. Brian GernhardtDec 22, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.