Merge branch 'maint-1.6.5' into maint

* maint-1.6.5:
  blame: prevent a segv when -L given start > EOF
This commit is contained in:
Junio C Hamano 2010-02-08 21:53:54 -08:00
commit e33cc592de
2 changed files with 9 additions and 1 deletions

View File

@ -2433,7 +2433,7 @@ parse_done:
if (top < 1) if (top < 1)
top = lno; top = lno;
bottom--; bottom--;
if (lno < top) if (lno < top || lno < bottom)
die("file %s has only %lu lines", path, lno); die("file %s has only %lu lines", path, lno);
ent = xcalloc(1, sizeof(*ent)); ent = xcalloc(1, sizeof(*ent));

View File

@ -157,4 +157,12 @@ EOF
git --no-pager blame $COMMIT -- uno >/dev/null 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 test_done