Skip to contentSkip to conversation

t7700: demonstrate repack flaw which may loosen objects unnecessarily

PATCH In review Brandon Casey 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 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.

---
 t/t7700-repack.sh |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
t/t7700-repack.sh +0 -0
index 1ef3892..013e488 100755
@@ -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

Signature · 1 line
1.6.2.12.g83676