Skip to content

Commit daae062

Browse files
drafnelgitster
authored andcommitted
pack-objects: extend --local to mean ignore non-local loose objects too
With this patch, --local means pack only local objects that are not already packed. Additionally, this fixes t7700 testing whether loose objects in an alternate object database are repacked. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0f4dc14 commit daae062

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

Documentation/git-pack-objects.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ base-name::
121121
--local::
122122
This flag is similar to `--incremental`; instead of
123123
ignoring all packed objects, it only ignores objects
124-
that are packed and not in the local object store
124+
that are packed and/or not in the local object store
125125
(i.e. borrowed from an alternate).
126126

127127
--non-empty::

builtin-pack-objects.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,9 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
691691
return 0;
692692
}
693693

694+
if (!exclude && local && has_loose_object_nonlocal(sha1))
695+
return 0;
696+
694697
for (p = packed_git; p; p = p->next) {
695698
off_t offset = find_pack_entry_one(sha1, p);
696699
if (offset) {

t/t7700-repack.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
3434
test -z "$found_duplicate_object"
3535
'
3636

37-
test_expect_failure 'loose objects in alternate ODB are not repacked' '
37+
test_expect_success 'loose objects in alternate ODB are not repacked' '
3838
mkdir alt_objects &&
3939
echo `pwd`/alt_objects > .git/objects/info/alternates &&
4040
echo content3 > file3 &&

0 commit comments

Comments
 (0)