List for cgit developers and users
 help / color / mirror / Atom feed
From: list at eworm.de (Christian Hesse)
Subject: [PATCH v2 1/1] scan-tree: handle error in git_config_from_file()
Date: Wed,  9 Mar 2016 11:16:35 +0100	[thread overview]
Message-ID: <1457518595-9412-1-git-send-email-list@eworm.de> (raw)
In-Reply-To: <1457445106-17365-1-git-send-email-list@eworm.de>

From: Christian Hesse <mail at eworm.de>

We can live without config, but print an error if it is not readable.
---
 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,10 @@ 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);
+		}
 		strbuf_setlen(path, pathlen);
 	}
 
-- 
2.7.2



  parent reply	other threads:[~2016-03-09 10:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-08 13:51 [PATCH " list
2016-03-08 14:05 ` Jason
2016-03-08 14:11 ` john
2016-03-08 14:26   ` list
2016-03-08 14:36     ` john
2016-03-08 14:54       ` list
2016-03-08 14:59         ` john
2016-03-08 15:01           ` list
2016-03-08 15:05             ` john
2016-03-08 15:08             ` list
2016-03-09 10:16 ` list [this message]
2016-03-09 11:05   ` [PATCH v2 " Jason
2016-03-11  7:49     ` list

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457518595-9412-1-git-send-email-list@eworm.de \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).