@matheusbsbs / matheus-bagliano / commits / 93a56c2cf7
Fork 0

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

Instead of simply exiting with 255, print an error message including the reason why a config file specified through --file cannot be opened or read. The problem was noticed by Joey Hess, reported through http://bugs.debian.org/445208 Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Gerrit Pape committed Oct 12, 2007 at 11:40 UTC 93a56c2cf7c8b29ca4c5e0740fe1e487324ffc73
1 file changed +4 -1
builtin-config.c
+4 -1
@@ -175,7 +175,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)
175 else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l")) {
176 if (argc != 2)
177 usage(git_config_set_usage);
178 - return git_config(show_all_config);
178 + if (git_config(show_all_config) < 0 && file && errno)
179 + die("unable to read config file %s: %s", file,
180 + strerror(errno));
181 + return 0;
182 }
183 else if (!strcmp(argv[1], "--global")) {
184 char *home = getenv("HOME");