Skip to content

Commit

Permalink
t7700: demonstrate repack flaw which may loosen objects unnecessarily
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Mar 22, 2009
1 parent 4d6acb7 commit 869a3d3
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions t/t7700-repack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,22 @@ test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
test_must_fail git show $csha1
'

test_expect_failure '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

0 comments on commit 869a3d3

Please sign in to comment.