Skip to content

Commit

Permalink
pack-objects: only repack or loosen objects residing in "local" packs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brandon Casey authored and Junio C Hamano committed Mar 20, 2009
1 parent 171110a commit 79bc4c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions builtin-pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -1915,7 +1915,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)
const unsigned char *sha1;
struct object *o;

if (p->pack_keep)
if (!p->pack_local || p->pack_keep)
continue;
if (open_pack_index(p))
die("cannot open pack index");
Expand Down Expand Up @@ -1951,7 +1951,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)
const unsigned char *sha1;

for (p = packed_git; p; p = p->next) {
if (p->pack_keep)
if (!p->pack_local || p->pack_keep)
continue;

if (open_pack_index(p))
Expand Down
2 changes: 1 addition & 1 deletion t/t7700-repack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ test_expect_success 'packed obs in alternate ODB kept pack are repacked' '
done
'

test_expect_failure 'packed unreachable obs in alternate ODB are not loosened' '
test_expect_success 'packed unreachable obs in alternate ODB are not loosened' '
rm -f alt_objects/pack/*.keep &&
mv .git/objects/pack/* alt_objects/pack/ &&
csha1=$(git rev-parse HEAD^{commit}) &&
Expand Down

0 comments on commit 79bc4c7

Please sign in to comment.