Code

Merge branch 'maint-1.6.0' into maint-1.6.1
[git.git] / t / t7700-repack.sh
index fa4772101fda56116698f2063572ebfef8d4d46a..9ce546e3b225563279c54eb6ceafd87398a3e5cc 100755 (executable)
@@ -69,7 +69,7 @@ test_expect_success 'packed obs in alt ODB are repacked even when local repo is
        done
 '
 
-test_expect_failure 'packed obs in alternate ODB kept pack are repacked' '
+test_expect_success 'packed obs in alternate ODB kept pack are repacked' '
        # swap the .keep so the commit object is in the pack with .keep
        for p in alt_objects/pack/*.pack
        do
@@ -94,7 +94,7 @@ test_expect_failure 'packed obs in alternate ODB kept pack are repacked' '
        done
 '
 
-test_expect_failure 'packed unreachable obs in alternate ODB are not loosened' '
+test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
        rm -f alt_objects/pack/*.keep &&
        mv .git/objects/pack/* alt_objects/pack/ &&
        csha1=$(git rev-parse HEAD^{commit}) &&
@@ -113,5 +113,22 @@ test_expect_failure 'packed unreachable obs in alternate ODB are not loosened' '
        test_must_fail git show $csha1
 '
 
+test_expect_success 'local packed unreachable obs that exist in alternate ODB are not loosened' '
+       echo `pwd`/alt_objects > .git/objects/info/alternates &&
+       echo "$csha1" | git pack-objects --non-empty --all --reflog pack &&
+       rm -f .git/objects/pack/* &&
+       mv pack-* .git/objects/pack/ &&
+       # The pack-objects call on the next line is equivalent to
+       # git repack -A -d without the call to prune-packed
+       git pack-objects --honor-pack-keep --non-empty --all --reflog \
+           --unpack-unreachable </dev/null pack &&
+       rm -f .git/objects/pack/* &&
+       mv pack-* .git/objects/pack/ &&
+       test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
+               egrep "^$csha1 " | sort | uniq | wc -l) &&
+       echo > .git/objects/info/alternates &&
+       test_must_fail git show $csha1
+'
+
 test_done