diff options
author | Eric Sunshine <sunshine@sunshineco.com> | 2015-05-04 03:25:14 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-04 10:01:12 -0700 |
commit | f84a0ca2a4d493b9dc96ad023c9394102830992a (patch) | |
tree | 56d7d5be819a60918733e803e3faf41e15363633 | |
parent | 6e8b63b5b8cc31d4a06cb25f5389b822c186aaca (diff) | |
download | git-f84a0ca2a4d493b9dc96ad023c9394102830992a.tar.gz |
t1007: add hash-object --literally tests
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.
Also add a failing test demonstrating a crash (buffer overflow leading
to stack corruption) when the bogus type is lengthy.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | t/t1007-hash-object.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh index f83df8eb8b..0e65577038 100755 --- a/t/t1007-hash-object.sh +++ b/t/t1007-hash-object.sh @@ -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_failure '--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 |