Skip to content

Commit

Permalink
Merge branch 'mm/usage-log-l-can-take-regex' into maint-2.3
Browse files Browse the repository at this point in the history
Documentation fix.

* mm/usage-log-l-can-take-regex:
  log -L: improve error message on malformed argument
  Documentation: change -L:<regex> to -L:<funcname>
  • Loading branch information
gitster committed May 11, 2015
2 parents cd01208 + 0269f96 commit 811ce1b
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Documentation/blame-options.txt
Expand Up @@ -10,7 +10,7 @@
Include additional statistics at the end of blame output.

-L <start>,<end>::
-L :<regex>::
-L :<funcname>::
Annotate only the given line range. May be specified multiple times.
Overlapping ranges are allowed.
+
Expand Down
4 changes: 2 additions & 2 deletions Documentation/git-log.txt
Expand Up @@ -62,9 +62,9 @@ produced by `--stat`, etc.
output by allowing them to allocate space in advance.

-L <start>,<end>:<file>::
-L :<regex>:<file>::
-L :<funcname>:<file>::
Trace the evolution of the line range given by "<start>,<end>"
(or the funcname regex <regex>) within the <file>. You may
(or the function name regex <funcname>) within the <file>. You may
not give any pathspec limiters. This is currently limited to
a walk starting from a single revision, i.e., you may only
give zero or one positive revision arguments.
Expand Down
4 changes: 2 additions & 2 deletions Documentation/gitk.txt
Expand Up @@ -99,10 +99,10 @@ linkgit:git-rev-list[1] for a complete list.
detailed explanation.)

-L<start>,<end>:<file>::
-L:<regex>:<file>::
-L:<funcname>:<file>::

Trace the evolution of the line range given by "<start>,<end>"
(or the funcname regex <regex>) within the <file>. You may
(or the function name regex <funcname>) within the <file>. You may
not give any pathspec limiters. This is currently limited to
a walk starting from a single revision, i.e., you may only
give zero or one positive revision arguments.
Expand Down
11 changes: 6 additions & 5 deletions Documentation/line-range-format.txt
Expand Up @@ -22,8 +22,9 @@ This is only valid for <end> and will specify a number
of lines before or after the line given by <start>.

+
If ``:<regex>'' is given in place of <start> and <end>, it denotes the range
from the first funcname line that matches <regex>, up to the next
funcname line. ``:<regex>'' searches from the end of the previous `-L` range,
if any, otherwise from the start of file.
``^:<regex>'' searches from the start of file.
If ``:<funcname>'' is given in place of <start> and <end>, it is a
regular expression that denotes the range from the first funcname line
that matches <funcname>, up to the next funcname line. ``:<funcname>''
searches from the end of the previous `-L` range, if any, otherwise
from the start of file. ``^:<funcname>'' searches from the start of
file.
2 changes: 1 addition & 1 deletion line-log.c
Expand Up @@ -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++;
Expand Down
8 changes: 4 additions & 4 deletions t/t4211-line-log.sh
Expand Up @@ -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)' '
Expand Down

0 comments on commit 811ce1b

Please sign in to comment.