summaryrefslogtreecommitdiff
path: root/line-log.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-09 21:32:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-09-09 21:32:45 (GMT)
commit118b9d583637e6161c088eab7c8c290062e06aab (patch)
tree7a5e6f2319c028f89b969a2495c37f78d85402a9 /line-log.c
parent43012626401421c19e3fd211c27672890986f6b9 (diff)
parent5d57cac6ae7c661d430dcc7dd2e44c994bf797be (diff)
downloadgit-118b9d583637e6161c088eab7c8c290062e06aab.zip
git-118b9d583637e6161c088eab7c8c290062e06aab.tar.gz
git-118b9d583637e6161c088eab7c8c290062e06aab.tar.bz2
Merge branch 'es/blame-L-more'
More fixes to the code to parse the "-L" option in "log" and "blame". * es/blame-L-more: blame: reject empty ranges -L,+0 and -L,-0 t8001/t8002: blame: demonstrate acceptance of bogus -L,+0 and -L,-0 blame: reject empty ranges -LX,+0 and -LX,-0 t8001/t8002: blame: demonstrate acceptance of bogus -LX,+0 and -LX,-0 log: fix -L bounds checking bug t4211: retire soon-to-be unimplementable tests t4211: log: demonstrate -L bounds checking bug blame: fix -L bounds checking bug t8001/t8002: blame: add empty file & partial-line tests t8001/t8002: blame: demonstrate -L bounds checking bug t8001/t8002: blame: decompose overly-large test
Diffstat (limited to 'line-log.c')
-rw-r--r--line-log.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/line-log.c b/line-log.c
index c2d01dc..1c3ac8d 100644
--- a/line-log.c
+++ b/line-log.c
@@ -594,13 +594,13 @@ parse_lines(struct commit *commit, const char *prefix, struct string_list *args)
lines, &begin, &end,
full_name))
die("malformed -L argument '%s'", range_part);
+ if (lines < end || ((lines || begin) && lines < begin))
+ die("file %s has only %lu lines", name_part, lines);
if (begin < 1)
begin = 1;
if (end < 1)
end = lines;
begin--;
- if (lines < end || lines < begin)
- die("file %s has only %ld lines", name_part, lines);
line_log_data_insert(&ranges, full_name, begin, end);
free_filespec(spec);