From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: gitster@pobox.com
Cc: git@vger.kernel.org, mikachu@gmail.com,
ramsay@ramsay1.demon.co.uk, Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH v2 2/2] log -L: improve error message on malformed argument
Date: Mon, 20 Apr 2015 14:09:07 +0200 [thread overview]
Message-ID: <1429531747-15082-2-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <1429531747-15082-1-git-send-email-Matthieu.Moy@imag.fr>
The old message did not mention the :regex:file form.
To avoid overly long lines, split the message into two lines (in case
item->string is long, it will be the only part truncated in a narrow
terminal).
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
No change since v1 (except Junio's changes).
line-log.c | 2 +-
t/t4211-line-log.sh | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/line-log.c b/line-log.c
index b7864ad..1a6bc59 100644
--- a/line-log.c
+++ b/line-log.c
@@ -575,7 +575,7 @@ parse_lines(struct commit *commit, const char *prefix, struct string_list *args)
name_part = skip_range_arg(item->string);
if (!name_part || *name_part != ':' || !name_part[1])
- die("-L argument '%s' not of the form start,end:file",
+ die("-L argument not 'start,end:file' or ':funcname:file': %s",
item->string);
range_part = xstrndup(item->string, name_part - item->string);
name_part++;
diff --git a/t/t4211-line-log.sh b/t/t4211-line-log.sh
index 0901b30..4451127 100755
--- a/t/t4211-line-log.sh
+++ b/t/t4211-line-log.sh
@@ -54,14 +54,14 @@ canned_test "-L 4:a.c -L 8,12:a.c simple" multiple-superset
canned_test "-L 8,12:a.c -L 4:a.c simple" multiple-superset
test_bad_opts "-L" "switch.*requires a value"
-test_bad_opts "-L b.c" "argument.*not of the form"
-test_bad_opts "-L 1:" "argument.*not of the form"
+test_bad_opts "-L b.c" "argument not .start,end:file"
+test_bad_opts "-L 1:" "argument not .start,end:file"
test_bad_opts "-L 1:nonexistent" "There is no path"
test_bad_opts "-L 1:simple" "There is no path"
-test_bad_opts "-L '/foo:b.c'" "argument.*not of the form"
+test_bad_opts "-L '/foo:b.c'" "argument not .start,end:file"
test_bad_opts "-L 1000:b.c" "has only.*lines"
test_bad_opts "-L 1,1000:b.c" "has only.*lines"
-test_bad_opts "-L :b.c" "argument.*not of the form"
+test_bad_opts "-L :b.c" "argument not .start,end:file"
test_bad_opts "-L :foo:b.c" "no match"
test_expect_success '-L X (X == nlines)' '
--
2.4.0.rc1.42.g9642cc6
prev parent reply other threads:[~2015-04-20 12:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAHYJk3RQwDrtox+vB7G70qu1iCDcxCNDfxWyFS7_2CZQZCAgLA@mail.gmail.com>
2015-04-20 12:09 ` [PATCH v2 1/2] Documentation: change -L:<regex> to -L:<funcname> Matthieu Moy
2015-04-20 12:09 ` Matthieu Moy [this message]
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=1429531747-15082-2-git-send-email-Matthieu.Moy@imag.fr \
--to=matthieu.moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mikachu@gmail.com \
--cc=ramsay@ramsay1.demon.co.uk \
/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).