@matheusbsbs / matheus-bagliano / commits / 79bc4c7155
Fork 0

pack-objects: only repack or loosen objects residing in "local" packs

These two features were invented for use by repack when repack will delete the local packs that have been made redundant. The packs accessible through alternates are not deleted by repack, so the objects contained in them are still accessible after the local packs are deleted. They do not need to be repacked into the new pack or loosened. For the case of loosening they would immediately be deleted by the subsequent prune-packed that is called by repack anyway. This fixes the test 'packed unreachable obs in alternate ODB are not loosened' in t7700. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Brandon Casey committed Mar 19, 2009 at 22:47 UTC 79bc4c715516fdb393d107359327c1e7fbb8bf04
2 files changed +3 -3
builtin-pack-objects.c
+2 -2
@@ -1915,7 +1915,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
1915 const unsigned char *sha1;
1916 struct object *o;
1917
1918 - if (p->pack_keep)
1918 + if (!p->pack_local || p->pack_keep)
1919 continue;
1920 if (open_pack_index(p))
1921 die("cannot open pack index");
@@ -1951,7 +1951,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
1951 const unsigned char *sha1;
1952
1953 for (p = packed_git; p; p = p->next) {
1954 - if (p->pack_keep)
1954 + if (!p->pack_local || p->pack_keep)
1955 continue;
1956
1957 if (open_pack_index(p))
t/t7700-repack.sh
+1 -1
@@ -94,7 +94,7 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' '
94 done
95 '
96
97 -test_expect_failure 'packed unreachable obs in alternate ODB are not loosened' '
97 +test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
98 rm -f alt_objects/pack/*.keep &&
99 mv .git/objects/pack/* alt_objects/pack/ &&
100 csha1=$(git rev-parse HEAD^{commit}) &&