Skip to content

Commit

Permalink
git-config: print error message if the config file cannot be read
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gerrit Pape authored and Shawn O. Pearce committed Oct 18, 2007
1 parent a2d6b87 commit 93a56c2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion builtin-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 93a56c2

Please sign in to comment.