summaryrefslogtreecommitdiff
path: root/builtin/blame.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-09 14:32:45 -0700
committerJunio C Hamano <gitster@pobox.com>2013-09-09 14:32:45 -0700
commit118b9d583637e6161c088eab7c8c290062e06aab (patch)
tree7a5e6f2319c028f89b969a2495c37f78d85402a9 /builtin/blame.c
parent43012626401421c19e3fd211c27672890986f6b9 (diff)
parent5d57cac6ae7c661d430dcc7dd2e44c994bf797be (diff)
downloadgit-118b9d583637e6161c088eab7c8c290062e06aab.tar.gz
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 'builtin/blame.c')
-rw-r--r--builtin/blame.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/blame.c b/builtin/blame.c
index f932112e72..aa1abb6d5e 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2495,13 +2495,13 @@ parse_done:
bottom = top = 0;
if (bottomtop)
prepare_blame_range(&sb, bottomtop, lno, &bottom, &top);
+ if (lno < top || ((lno || bottom) && lno < bottom))
+ die("file %s has only %lu lines", path, lno);
if (bottom < 1)
bottom = 1;
if (top < 1)
top = lno;
bottom--;
- if (lno < top || lno < bottom)
- die("file %s has only %lu lines", path, lno);
ent = xcalloc(1, sizeof(*ent));
ent->lno = bottom;