Merge branch 'is/parsing-line-range'
Parsing of -L[<N>][,[<M>]] parameters "git blame" and "git log" take has been tweaked. * is/parsing-line-range: log: prevent error if line range ends past end of file blame: prevent error if range ends past end of file
This commit is contained in:
@ -598,11 +598,11 @@ parse_lines(struct commit *commit, const char *prefix, struct string_list *args)
|
||||
lines, anchor, &begin, &end,
|
||||
full_name))
|
||||
die("malformed -L argument '%s'", range_part);
|
||||
if (lines < end || ((lines || begin) && lines < begin))
|
||||
if ((!lines && (begin || end)) || lines < begin)
|
||||
die("file %s has only %lu lines", name_part, lines);
|
||||
if (begin < 1)
|
||||
begin = 1;
|
||||
if (end < 1)
|
||||
if (end < 1 || lines < end)
|
||||
end = lines;
|
||||
begin--;
|
||||
line_log_data_insert(&ranges, full_name, begin, end);
|
||||
|
||||
Reference in New Issue
Block a user