From: Tanay Abhra <tanayabh@gmail.com>
To: git@vger.kernel.org
Cc: Tanay Abhra <tanayabh@gmail.com>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Subject: [PATCH 2/2] add variable name to `git_config_*()` error message
Date: Thu, 31 Jul 2014 06:42:06 -0700 [thread overview]
Message-ID: <1406814126-10457-2-git-send-email-tanayabh@gmail.com> (raw)
In-Reply-To: <1406814126-10457-1-git-send-email-tanayabh@gmail.com>
Whenever a callback returns a negative value, the functions
of `git_config_*()` family die printing the line number and
file name. In addition to them, add the variable name to the
error message.
Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
---
config.c | 4 ++--
t/t4055-diff-context.sh | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/config.c b/config.c
index 7330789..77407da 100644
--- a/config.c
+++ b/config.c
@@ -442,9 +442,9 @@ static int git_parse_source(config_fn_t fn, void *data)
break;
}
if (cf->die_on_error)
- die(_("bad config file line %d in %s"), cf->linenr, cf->name);
+ die(_("bad config variable '%s' at file line %d in %s"), var->buf, cf->linenr, cf->name);
else
- return error(_("bad config file line %d in %s"), cf->linenr, cf->name);
+ return error(_("bad config variable '%s' at file line %d in %s"), var->buf, cf->linenr, cf->name);
}
static int parse_unit_factor(const char *end, uintmax_t *val)
diff --git a/t/t4055-diff-context.sh b/t/t4055-diff-context.sh
index cd04543..741e080 100755
--- a/t/t4055-diff-context.sh
+++ b/t/t4055-diff-context.sh
@@ -79,7 +79,7 @@ test_expect_success 'non-integer config parsing' '
test_expect_success 'negative integer config parsing' '
git config diff.context -1 &&
test_must_fail git diff 2>output &&
- test_i18ngrep "bad config file" output
+ test_i18ngrep "bad config variable" output
'
test_expect_success '-U0 is valid, so is diff.context=0' '
--
1.9.0.GIT
next prev parent reply other threads:[~2014-07-31 13:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-31 13:42 [PATCH v2 1/2] config.c: mark error and warnings strings for translation Tanay Abhra
2014-07-31 13:42 ` Tanay Abhra [this message]
2014-07-31 15:23 ` [PATCH 2/2] add variable name to `git_config_*()` error message Tanay Abhra
2014-07-31 13:50 ` [PATCH v2 1/2] config.c: mark error and warnings strings for translation Matthieu Moy
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=1406814126-10457-2-git-send-email-tanayabh@gmail.com \
--to=tanayabh@gmail.com \
--cc=Matthieu.Moy@grenoble-inp.fr \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
/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).