mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
line-range: teach -L^/RE/ to search from start of file
The -L/RE/ option of blame/log searches from the end of the previous -L range, if any. Add new notation -L^/RE/ to override this behavior and search from start of file. The new ^/RE/ syntax is valid only as the <start> argument of -L<start>,<end>. The <end> argument, as usual, is relative to <start>. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
0bc2cdd550
commit
a6ac5f9864
10
line-range.c
10
line-range.c
@@ -59,8 +59,14 @@ static const char *parse_loc(const char *spec, nth_line_fn_t nth_line,
|
||||
return term;
|
||||
}
|
||||
|
||||
if (begin < 0)
|
||||
begin = -begin;
|
||||
if (begin < 0) {
|
||||
if (spec[0] != '^')
|
||||
begin = -begin;
|
||||
else {
|
||||
begin = 1;
|
||||
spec++;
|
||||
}
|
||||
}
|
||||
|
||||
if (spec[0] != '/')
|
||||
return spec;
|
||||
|
||||
Reference in New Issue
Block a user