]> git.ipfire.org Git - thirdparty/git.git/blobdiff - t/t5310-pack-bitmaps.sh
rev-list: disable --use-bitmap-index when pruning commits
[thirdparty/git.git] / t / t5310-pack-bitmaps.sh
index f13525caa309e48ab32f89066a3e9661dfc25e09..bbb7623e70463572d1041ca0e016952fb227a296 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
@@ -49,6 +53,12 @@ rev_list_tests() {
                test_cmp expect actual
        '
 
+       test_expect_success "counting commits with limiting ($state)" '
+               git rev-list --count HEAD -- 1.t >expect &&
+               git rev-list --use-bitmap-index --count HEAD -- 1.t >actual &&
+               test_cmp expect actual
+       '
+
        test_expect_success "enumerate --objects ($state)" '
                git rev-list --objects --use-bitmap-index HEAD >tmp &&
                cut -d" " -f1 <tmp >tmp2 &&
@@ -115,6 +125,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
 '