summaryrefslogtreecommitdiff
path: root/line-range.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-08-02 15:30:41 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-02 15:30:41 -0700
commit6566a917d8a8d3070b5fdc94fbe5f6d68a4d656b (patch)
tree5a8ac927a48d840786c5cca578221008f2baf9d1 /line-range.c
parentMerge branch 'jt/fetch-pack-negotiator' (diff)
parentlog: prevent error if line range ends past end of file (diff)
downloadtgif-6566a917d8a8d3070b5fdc94fbe5f6d68a4d656b.tar.xz
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
Diffstat (limited to 'line-range.c')
-rw-r--r--line-range.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/line-range.c b/line-range.c
index 323399d16c..232c3909ec 100644
--- a/line-range.c
+++ b/line-range.c
@@ -47,7 +47,7 @@ static const char *parse_loc(const char *spec, nth_line_fn_t nth_line,
else if (!num)
*ret = begin;
else
- *ret = begin + num;
+ *ret = begin + num > 0 ? begin + num : 1;
return term;
}
return spec;