diff options
author | Clemens Buchacher <drizzd@aon.at> | 2012-02-13 21:17:11 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-13 12:49:15 -0800 |
commit | cb8da70547af5cd5c8e03be5a236971951e81277 (patch) | |
tree | 17f6330e734a92f05263cac4818ff862adb19665 /t/t1450-fsck.sh | |
parent | d0482e88a735787f7bb33ef4783be0e7f6a70946 (diff) | |
download | git-cb8da70547af5cd5c8e03be5a236971951e81277.tar.gz |
git rev-list: fix invalid typecastcb/maint-rev-list-verify-object
git rev-list passes rev_list_info, not rev_list objects. Without this
fix, rev-list enables or disables the --verify-objects option depending
on a read from an undefined memory location.
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1450-fsck.sh')
-rwxr-xr-x | t/t1450-fsck.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 523ce9c45b..5b8ebd8053 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -191,4 +191,30 @@ test_expect_success 'cleaned up' ' test_cmp empty actual ' +test_expect_success 'rev-list --verify-objects' ' + git rev-list --verify-objects --all >/dev/null 2>out && + test_cmp empty out +' + +test_expect_success 'rev-list --verify-objects with bad sha1' ' + sha=$(echo blob | git hash-object -w --stdin) && + old=$(echo $sha | sed "s+^..+&/+") && + new=$(dirname $old)/ffffffffffffffffffffffffffffffffffffff && + sha="$(dirname $new)$(basename $new)" && + mv .git/objects/$old .git/objects/$new && + test_when_finished "remove_object $sha" && + git update-index --add --cacheinfo 100644 $sha foo && + test_when_finished "git read-tree -u --reset HEAD" && + tree=$(git write-tree) && + test_when_finished "remove_object $tree" && + cmt=$(echo bogus | git commit-tree $tree) && + test_when_finished "remove_object $cmt" && + git update-ref refs/heads/bogus $cmt && + test_when_finished "git update-ref -d refs/heads/bogus" && + + test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out && + cat out && + grep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out +' + test_done |