@matheusbsbs / matheus-bagliano / commits / 869a3d34c1
Fork 0

t7700: demonstrate repack flaw which may loosen objects unnecessarily

If an unreferenced object exists in both a local pack and in either a pack residing in an alternate object database or a local kept pack, then the pack-objects call made by repack will loosen that object only to have it immediately pruned by repack's call to prune-packed. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Casey committed Mar 21, 2009 at 17:25 UTC 869a3d34c1aea92a10bc8eaa994bd55f4b0b04f2
1 file changed +17
t/t7700-repack.sh
+17
@@ -113,5 +113,22 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
113 test_must_fail git show $csha1
114 '
115
116 +test_expect_failure 'local packed unreachable obs that exist in alternate ODB are not loosened' '
117 + echo `pwd`/alt_objects > .git/objects/info/alternates &&
118 + echo "$csha1" | git pack-objects --non-empty --all --reflog pack &&
119 + rm -f .git/objects/pack/* &&
120 + mv pack-* .git/objects/pack/ &&
121 + # The pack-objects call on the next line is equivalent to
122 + # git repack -A -d without the call to prune-packed
123 + git pack-objects --honor-pack-keep --non-empty --all --reflog \
124 + --unpack-unreachable </dev/null pack &&
125 + rm -f .git/objects/pack/* &&
126 + mv pack-* .git/objects/pack/ &&
127 + test 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |
128 + egrep "^$csha1 " | sort | uniq | wc -l) &&
129 + echo > .git/objects/info/alternates &&
130 + test_must_fail git show $csha1
131 +'
132 +
133 test_done
134