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

Re: [PATCH] git-config: print error message if the config file cannot be read

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Oct 9, 2007, 13:30 UTC
Message-ID
<470B8286.5060006@viscovery.net>
In-Reply-To
<20071009125102.1305.qmail@054bd0fc8effa5.315fe32.mid.smarden.org>
Gerrit Pape schrieb:
Show 10 quoted lines
> @@ -235,8 +235,12 @@ int cmd_config(int argc, const char **argv, const char *prefix)
>  		argv++;
>  	}
>  
> -	if (show_all)
> -		return git_config(show_all_config);
> +	if (show_all) {
> +		if (git_config(show_all_config) == -1)
> +			die("unable to read config file %s: %s",
> +			    getenv(CONFIG_ENVIRONMENT), strerror(errno));

I don't think that this works well: If there are no config files at all, then we don't want to see an error - just as if the config file were empty.

Also, I don't think that errno is reliable at this point.

You probably want to see an error message *only* if you have supplied a file name with --file.

-- Hannes
Previous: Johannes SchindelinNext: Gerrit Pape
Message 3 of 5 in “git-config: print error message if the config file cannot be read”
  1. git-config: print error message if the config file cannot be readGerrit Pape, Oct 9, 2007
  2. Johannes SchindelinOct 9, 2007
  3. Johannes SixtOct 9, 2007
  4. git-config: print error message if the config file cannot be readGerrit Pape, Oct 12, 2007
  5. Johannes SixtOct 12, 2007

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.