Skip to content

Commit 6749850

Browse files
committed
Merge branch 'mm/usage-log-l-can-take-regex'
Documentation fix. * mm/usage-log-l-can-take-regex: log -L: improve error message on malformed argument Documentation: change -L:<regex> to -L:<funcname>
2 parents 64c9e02 + 0269f96 commit 6749850

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

Documentation/blame-options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Include additional statistics at the end of blame output.
1111

1212
-L <start>,<end>::
13-
-L :<regex>::
13+
-L :<funcname>::
1414
Annotate only the given line range. May be specified multiple times.
1515
Overlapping ranges are allowed.
1616
+

Documentation/git-log.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ produced by `--stat`, etc.
6262
output by allowing them to allocate space in advance.
6363

6464
-L <start>,<end>:<file>::
65-
-L :<regex>:<file>::
65+
-L :<funcname>:<file>::
6666
Trace the evolution of the line range given by "<start>,<end>"
67-
(or the funcname regex <regex>) within the <file>. You may
67+
(or the function name regex <funcname>) within the <file>. You may
6868
not give any pathspec limiters. This is currently limited to
6969
a walk starting from a single revision, i.e., you may only
7070
give zero or one positive revision arguments.

Documentation/gitk.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ linkgit:git-rev-list[1] for a complete list.
9999
detailed explanation.)
100100

101101
-L<start>,<end>:<file>::
102-
-L:<regex>:<file>::
102+
-L:<funcname>:<file>::
103103

104104
Trace the evolution of the line range given by "<start>,<end>"
105-
(or the funcname regex <regex>) within the <file>. You may
105+
(or the function name regex <funcname>) within the <file>. You may
106106
not give any pathspec limiters. This is currently limited to
107107
a walk starting from a single revision, i.e., you may only
108108
give zero or one positive revision arguments.

Documentation/line-range-format.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ This is only valid for <end> and will specify a number
2222
of lines before or after the line given by <start>.
2323

2424
+
25-
If ``:<regex>'' is given in place of <start> and <end>, it denotes the range
26-
from the first funcname line that matches <regex>, up to the next
27-
funcname line. ``:<regex>'' searches from the end of the previous `-L` range,
28-
if any, otherwise from the start of file.
29-
``^:<regex>'' searches from the start of file.
25+
If ``:<funcname>'' is given in place of <start> and <end>, it is a
26+
regular expression that denotes the range from the first funcname line
27+
that matches <funcname>, up to the next funcname line. ``:<funcname>''
28+
searches from the end of the previous `-L` range, if any, otherwise
29+
from the start of file. ``^:<funcname>'' searches from the start of
30+
file.

line-log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ parse_lines(struct commit *commit, const char *prefix, struct string_list *args)
575575

576576
name_part = skip_range_arg(item->string);
577577
if (!name_part || *name_part != ':' || !name_part[1])
578-
die("-L argument '%s' not of the form start,end:file",
578+
die("-L argument not 'start,end:file' or ':funcname:file': %s",
579579
item->string);
580580
range_part = xstrndup(item->string, name_part - item->string);
581581
name_part++;

t/t4211-line-log.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ canned_test "-L 4:a.c -L 8,12:a.c simple" multiple-superset
5454
canned_test "-L 8,12:a.c -L 4:a.c simple" multiple-superset
5555

5656
test_bad_opts "-L" "switch.*requires a value"
57-
test_bad_opts "-L b.c" "argument.*not of the form"
58-
test_bad_opts "-L 1:" "argument.*not of the form"
57+
test_bad_opts "-L b.c" "argument not .start,end:file"
58+
test_bad_opts "-L 1:" "argument not .start,end:file"
5959
test_bad_opts "-L 1:nonexistent" "There is no path"
6060
test_bad_opts "-L 1:simple" "There is no path"
61-
test_bad_opts "-L '/foo:b.c'" "argument.*not of the form"
61+
test_bad_opts "-L '/foo:b.c'" "argument not .start,end:file"
6262
test_bad_opts "-L 1000:b.c" "has only.*lines"
6363
test_bad_opts "-L 1,1000:b.c" "has only.*lines"
64-
test_bad_opts "-L :b.c" "argument.*not of the form"
64+
test_bad_opts "-L :b.c" "argument not .start,end:file"
6565
test_bad_opts "-L :foo:b.c" "no match"
6666

6767
test_expect_success '-L X (X == nlines)' '

0 commit comments

Comments
 (0)