diff options
author | Johannes Sixt <johannes.sixt@telecom.at> | 2006-11-13 13:50:00 +0000 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-11-13 14:26:51 -0800 |
commit | 3d12d0cfbbda0feb6305d6c53f3cf9aae2330c4c (patch) | |
tree | 9456a5b78dc2991f7158e8e1c536aa0db1a7d8df /t/t0000-basic.sh | |
parent | 40cf043389ef4cdf3e56e7c4268d6f302e387fa0 (diff) | |
download | git-3d12d0cfbbda0feb6305d6c53f3cf9aae2330c4c.tar.gz |
Catch errors when writing an index that contains invalid objects.
If git-write-index is called without --missing-ok, it reports invalid
objects that it finds in the index. But without this patch it dies
right away or may run into an infinite loop.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 't/t0000-basic.sh')
-rwxr-xr-x | t/t0000-basic.sh | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 2c9bbb59b0..6aff0b808c 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -209,6 +209,28 @@ test_expect_success \ 'validate object ID for a known tree.' \ 'test "$ptree" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2' +cat >badobjects <<EOF +100644 blob 1000000000000000000000000000000000000000 dir/file1 +100644 blob 2000000000000000000000000000000000000000 dir/file2 +100644 blob 3000000000000000000000000000000000000000 dir/file3 +100644 blob 4000000000000000000000000000000000000000 dir/file4 +100644 blob 5000000000000000000000000000000000000000 dir/file5 +EOF + +rm .git/index +test_expect_success \ + 'put invalid objects into the index.' \ + 'git-update-index --index-info < badobjects' + +test_expect_failure \ + 'writing this tree without --missing-ok.' \ + 'git-write-tree' + +test_expect_success \ + 'writing this tree with --missing-ok.' \ + 'git-write-tree --missing-ok' + + ################################################################ rm .git/index test_expect_success \ |