aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2007-10-12 11:40:57 +0000
committerShawn O. Pearce <spearce@spearce.org>2007-10-18 01:35:33 -0400
commit93a56c2cf7c8b29ca4c5e0740fe1e487324ffc73 (patch)
treed6c4f27eb2cc4e0f449a9a3e618e97b96502ec5e
parenta2d6b872dbf4e65525c9ba55e820e2ea26011ce1 (diff)
downloadgit-93a56c2cf7c8b29ca4c5e0740fe1e487324ffc73.tar.gz
git-93a56c2cf7c8b29ca4c5e0740fe1e487324ffc73.tar.xz
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>
-rw-r--r--builtin-config.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin-config.c b/builtin-config.c
index d98b6c2c4..e5e243f27 100644
--- a/builtin-config.c
+++ b/builtin-config.c
@@ -175,7 +175,10 @@ int cmd_config(int argc, const char **argv, const char *prefix)
else if (!strcmp(argv[1], "--list") || !strcmp(argv[1], "-l")) {
if (argc != 2)
usage(git_config_set_usage);
- return git_config(show_all_config);
+ if (git_config(show_all_config) < 0 && file && errno)
+ die("unable to read config file %s: %s", file,
+ strerror(errno));
+ return 0;
}
else if (!strcmp(argv[1], "--global")) {
char *home = getenv("HOME");