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

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

From
Gerrit Pape <pape@smarden.org>
Date
Oct 9, 2007, 12:51 UTC
Message-ID
<20071009125102.1305.qmail@054bd0fc8effa5.315fe32.mid.smarden.org>

Instead of simply exiting with 255, print an error message including the reason why the config file cannot be opened or read.

The problem was noticed by Joey Hess, reported through
 http://bugs.debian.org/445208
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 builtin-config.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin-config.c b/builtin-config.c
index 1bb0ebb..750a403 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -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));
+		return 0;
+	}
 	switch (argc) {
 	case 2:
 		return get_value(argv[1], NULL);
-- 
1.5.3.4
Next: Johannes Schindelin
Message 1 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.