git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 2/2] log -L: improve error message on malformed argument

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
Apr 20, 2015, 12:09 UTC
Message-ID
<1429531747-15082-2-git-send-email-Matthieu.Moy@imag.fr>
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
Previous: Matthieu Moy
Message 2 of 2 in “Documentation: change -L:<regex> to -L:<funcname>”
  1. 1/2 Documentation: change -L:<regex> to -L:<funcname>Matthieu Moy, Apr 20, 2015
  2. 2/2 log -L: improve error message on malformed argumentMatthieu Moy, Apr 20, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.