diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-09-09 14:32:45 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-09-09 14:32:45 -0700 |
commit | 118b9d583637e6161c088eab7c8c290062e06aab (patch) | |
tree | 7a5e6f2319c028f89b969a2495c37f78d85402a9 /builtin | |
parent | Merge branch 'db/http-savecookies' (diff) | |
parent | blame: reject empty ranges -L,+0 and -L,-0 (diff) | |
download | tgif-118b9d583637e6161c088eab7c8c290062e06aab.tar.xz |
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')
-rw-r--r-- | builtin/blame.c | 4 |
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; |