Merge branch 'jc/graduate-remote-hg-bzr' (early part)
[gitweb.git] / t / t5310-pack-bitmaps.sh
index f13525caa309e48ab32f89066a3e9661dfc25e09..f4f02ba918535d5c40a30585a54469bc12ab96d3 100755 (executable)
@@ -3,6 +3,10 @@
 test_description='exercise basic bitmap functionality'
 . ./test-lib.sh
 
+objpath () {
+       echo ".git/objects/$(echo "$1" | sed -e 's|\(..\)|\1/|')"
+}
+
 test_expect_success 'setup repo with moderate-sized history' '
        for i in $(test_seq 1 10); do
                test_commit $i
@@ -115,6 +119,33 @@ test_expect_success 'fetch (full bitmap)' '
        test_cmp expect actual
 '
 
+test_expect_success 'create objects for missing-HAVE tests' '
+       blob=$(echo "missing have" | git hash-object -w --stdin) &&
+       tree=$(printf "100644 blob $blob\tfile\n" | git mktree) &&
+       parent=$(echo parent | git commit-tree $tree) &&
+       commit=$(echo commit | git commit-tree $tree -p $parent) &&
+       cat >revs <<-EOF
+       HEAD
+       ^HEAD^
+       ^$commit
+       EOF
+'
+
+test_expect_success 'pack with missing blob' '
+       rm $(objpath $blob) &&
+       git pack-objects --stdout --revs <revs >/dev/null
+'
+
+test_expect_success 'pack with missing tree' '
+       rm $(objpath $tree) &&
+       git pack-objects --stdout --revs <revs >/dev/null
+'
+
+test_expect_success 'pack with missing parent' '
+       rm $(objpath $parent) &&
+       git pack-objects --stdout --revs <revs >/dev/null
+'
+
 test_lazy_prereq JGIT '
        type jgit
 '