]> git.ipfire.org Git - thirdparty/git.git/commitdiff
log -L: improve error message on malformed argument
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Mon, 20 Apr 2015 12:09:07 +0000 (14:09 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Apr 2015 18:06:10 +0000 (11:06 -0700)
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>
line-log.c
t/t4211-line-log.sh

index b7864ad5869eb076e778c352e2f64666dc77a525..1a6bc5921b4890273e4e9edab4d456cc27fd4064 100644 (file)
@@ -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++;
index 0901b3098239863df983faa61d2b00ce2c4d670d..4451127eb24051dcc3d2aebd443d10619c525e27 100755 (executable)
@@ -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)' '