Skip to content

Commit 79bc4c7

Browse files
drafnelgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 171110a commit 79bc4c7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

builtin-pack-objects.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,7 +1915,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
19151915
const unsigned char *sha1;
19161916
struct object *o;
19171917

1918-
if (p->pack_keep)
1918+
if (!p->pack_local || p->pack_keep)
19191919
continue;
19201920
if (open_pack_index(p))
19211921
die("cannot open pack index");
@@ -1951,7 +1951,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
19511951
const unsigned char *sha1;
19521952

19531953
for (p = packed_git; p; p = p->next) {
1954-
if (p->pack_keep)
1954+
if (!p->pack_local || p->pack_keep)
19551955
continue;
19561956

19571957
if (open_pack_index(p))

t/t7700-repack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' '
9494
done
9595
'
9696

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' '
9898
rm -f alt_objects/pack/*.keep &&
9999
mv .git/objects/pack/* alt_objects/pack/ &&
100100
csha1=$(git rev-parse HEAD^{commit}) &&

0 commit comments

Comments
 (0)