From: Jeff King <peff@peff.net>
To: Tanay Abhra <tanayabh@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, Andreas Krey <a.krey@gmx.de>,
git@vger.kernel.org
Subject: Re: [PATCH] config: add show_err flag to git_config_parse_key()
Date: Tue, 10 Feb 2015 19:27:54 -0500 [thread overview]
Message-ID: <20150211002754.GC30561@peff.net> (raw)
In-Reply-To: <54DA5FC1.9010707@gmail.com>
On Wed, Feb 11, 2015 at 01:15:05AM +0530, Tanay Abhra wrote:
> I just saw your mail late in the night (I didn't had net for a week).
> This patch just squelches the error message, I will take a better
> look tomorrow morning.
Thanks, this is probably a good first step. We can worry about making
the config look actually _work_ as the next step (which does not even
have to happen right now; it is not like it hasn't been this way since
the very beginning of git).
Another option for this first step would be to actually make
git_config_parse_key permissive, rather than just squelching the error.
That is, to actually look up pager.under_score rather than silently
erroring out with an invalid key whenever we are reading (whereas on the
writing side, we _do_ want to make sure we enforce syntactic validity).
I doubt it matters, much, though. Such a lookup would never succeed,
because the config file parser will also not allow it. So assuming the
syntactic rules here match what the config file parser does, they are at
worst redundant.
> builtin/config.c | 2 +-
> cache.h | 2 +-
> config.c | 19 ++++++++++++-------
> 3 files changed, 14 insertions(+), 9 deletions(-)
Here's a test that can be squashed in:
diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh
index da958a8..a28a2fd 100755
--- a/t/t7006-pager.sh
+++ b/t/t7006-pager.sh
@@ -447,4 +447,14 @@ test_expect_success TTY 'external command pagers override sub-commands' '
test_cmp expect actual
'
+test_expect_success 'command with underscores does not complain' '
+ write_script git-under_score <<-\EOF &&
+ echo ok
+ EOF
+ git --exec-path=. under_score >actual 2>&1 &&
+ echo ok >expect &&
+ test_cmp expect actual
+'
+
+
test_done
I was tempted to also add something like:
test_expect_failure TTY 'command with underscores can override pager' '
test_config pager.under_score "sed s/^/paged://" &&
git --exec-path=. under_score >actual &&
echo paged:ok >expect &&
test_cmp expect actual
'
but I am not sure it is worth adding the test, even as a placeholder.
Unless we are planning to relax the config syntax, the correct spelling
is more like "pager.under_score.command". It's probably better to just
add the test along with the code when we know what the final form will
look like.
-Peff
next prev parent reply other threads:[~2015-02-11 0:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-06 12:45 BUG: 'error: invalid key: pager.show_ref' on 'git show_ref' Andreas Krey
2015-02-06 19:33 ` Jeff King
2015-02-06 19:44 ` Junio C Hamano
2015-02-06 20:39 ` Jeff King
2015-02-10 19:45 ` [PATCH] config: add show_err flag to git_config_parse_key() Tanay Abhra
2015-02-11 0:27 ` Jeff King [this message]
2015-02-11 18:47 ` Junio C Hamano
2015-02-16 7:58 ` [PATCH v2] add a flag to supress errors in git_config_parse_key() Tanay Abhra
2015-02-18 19:02 ` Jeff King
2015-02-07 0:03 ` BUG: 'error: invalid key: pager.show_ref' on 'git show_ref' Mikael Magnusson
2015-02-07 5:01 ` Jeff King
2015-02-06 20:14 ` Junio C Hamano
2015-02-06 20:37 ` Jeff King
2015-02-06 22:17 ` Junio C Hamano
2015-02-06 22:27 ` Junio C Hamano
2015-02-07 4:52 ` Jeff King
-- strict thread matches above, loose matches on Subject: below --
2014-10-30 18:18 [PATCH] config: add show_err flag to git_config_parse_key() Tanay Abhra
2014-10-30 17:48 Tanay Abhra
2014-10-30 18:21 ` Junio C Hamano
2014-10-30 18:25 ` Tanay Abhra
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=20150211002754.GC30561@peff.net \
--to=peff@peff.net \
--cc=a.krey@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=tanayabh@gmail.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).