t8001/t8002: blame: add tests of -L line numbers less than 1
authorEric Sunshine <sunshine@sunshineco.com>
Tue, 6 Aug 2013 13:59:48 +0000 (09:59 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 6 Aug 2013 21:48:29 +0000 (14:48 -0700)
git-blame -L is documented as accepting 1-based line numbers. When
handed a line number less than 1, -L's behavior is undocumented and
undefined; it's also nonsensical and should be rejected but is
nevertheless accepted. Demonstrate this shortcoming.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/annotate-tests.sh
index dabe89d91a2198f8c8f0c3d42eb5d2cc480b5a14..376b042f2fbc9563a96f720e43625c27d141a39e 100644 (file)
@@ -185,6 +185,18 @@ test_expect_success 'blame -L Y,X (undocumented)' '
        check_count -L6,3 B 1 B1 1 B2 1 D 1
 '
 
+test_expect_failure 'blame -L -X' '
+       test_must_fail $PROG -L-1 file
+'
+
+test_expect_failure 'blame -L 0' '
+       test_must_fail $PROG -L0 file
+'
+
+test_expect_failure 'blame -L ,0' '
+       test_must_fail $PROG -L,0 file
+'
+
 test_expect_success 'blame -L ,+0' '
        test_must_fail $PROG -L,+0 file
 '