[PATCH 1/1] scan-tree: handle error in git_config_from_file()

Christian Hesse list at eworm.de
Tue Mar 8 14:51:46 CET 2016


From: Christian Hesse <mail at eworm.de>

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 scan-tree.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scan-tree.c b/scan-tree.c
index 2e87999..bc17d14 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -121,7 +121,11 @@ static void add_repo(const char *base, struct strbuf *path, repo_config_fn fn)
 	config_fn = fn;
 	if (ctx.cfg.enable_git_config) {
 		strbuf_addstr(path, "config");
-		git_config_from_file(gitconfig_config, path->buf, NULL);
+		if (git_config_from_file(gitconfig_config, path->buf, NULL)) {
+			fprintf(stderr, "Error reading config %s: %s (%d)\n",
+				path->buf, strerror(errno), errno);
+			return;
+		}
 		strbuf_setlen(path, pathlen);
 	}
 
-- 
2.7.2



More information about the CGit mailing list