Skip to content

Commit

Permalink
Merge branch 'maint-1.6.5' into maint
Browse files Browse the repository at this point in the history
* maint-1.6.5:
  blame: prevent a segv when -L given start > EOF
  • Loading branch information
Junio C Hamano committed Feb 9, 2010
2 parents a598331 + 92f9e27 commit e33cc59
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -2433,7 +2433,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
if (top < 1)
top = lno;
bottom--;
if (lno < top)
if (lno < top || lno < bottom)
die("file %s has only %lu lines", path, lno);

ent = xcalloc(1, sizeof(*ent));
Expand Down
8 changes: 8 additions & 0 deletions t/t8003-blame.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,12 @@ EOF
git --no-pager blame $COMMIT -- uno >/dev/null
'

test_expect_success 'blame -L with invalid start' '
test_must_fail git blame -L5 tres 2>&1 | grep "has only 2 lines"
'

test_expect_success 'blame -L with invalid end' '
git blame -L1,5 tres 2>&1 | grep "has only 2 lines"
'

test_done

0 comments on commit e33cc59

Please sign in to comment.