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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Gerrit Pape
Date: Tuesday, October 9, 2007 - 5:51 am

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

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] git-config: print error message if the config file ..., Gerrit Pape, (Tue Oct 9, 5:51 am)
Re: [PATCH] git-config: print error message if the config ..., Johannes Schindelin, (Tue Oct 9, 6:16 am)