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 <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Casey committed
Nov 9, 2008 at 23:59 UTC
daae06259556246959963947752bde4ee2df7b44
3 files changed
+5
-2
Documentation/git-pack-objects.txt
+1
-1
@@ -121,7 +121,7 @@ base-name::
121
--local::
122
This flag is similar to `--incremental`; instead of
123
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
125
(i.e. borrowed from an alternate).
126
127
--non-empty::
builtin-pack-objects.c
+3
@@ -691,6 +691,9 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
691
return 0;
692
}
693
694
+ if (!exclude && local && has_loose_object_nonlocal(sha1))
695
+ return 0;
696
+
697
for (p = packed_git; p; p = p->next) {
698
off_t offset = find_pack_entry_one(sha1, p);
699
if (offset) {
t/t7700-repack.sh
+1
-1
@@ -34,7 +34,7 @@ test_expect_success 'objects in packs marked .keep are not repacked' '
34
test -z "$found_duplicate_object"
35
'
36
37
-test_expect_failure 'loose objects in alternate ODB are not repacked' '
37
+test_expect_success 'loose objects in alternate ODB are not repacked' '
38
mkdir alt_objects &&
39
echo `pwd`/alt_objects > .git/objects/info/alternates &&
40
echo content3 > file3 &&