t1007: add hash-object --literally tests
authorEric Sunshine <sunshine@sunshineco.com>
Mon, 4 May 2015 07:25:14 +0000 (03:25 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 5 May 2015 17:17:54 +0000 (10:17 -0700)
git-hash-object learned a --literally option in 5ba9a93
(hash-object: add --literally option, 2014-09-11). Check that
--literally allows object creation with a bogus type, with two
type strings whose length is reasonably short and very long.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1007-hash-object.sh
index f83df8eb8b143086df00e163a30ad96e43404001..7c3dcfb70ccb32314eb0a95edb0d2522936f48dd 100755 (executable)
@@ -201,4 +201,15 @@ test_expect_success 'corrupt tag' '
        test_must_fail git hash-object -t tag --stdin </dev/null
 '
 
+test_expect_success '--literally' '
+       t=1234567890 &&
+       echo example | git hash-object -t $t --literally --stdin
+'
+
+test_expect_success '--literally with extra-long type' '
+       t=12345678901234567890123456789012345678901234567890 &&
+       t="$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t$t" &&
+       echo example | git hash-object -t $t --literally --stdin
+'
+
 test_done