summaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-11-12 22:00:43 -0800
committerJunio C Hamano <gitster@pobox.com>2008-11-12 22:00:43 -0800
commitecbbfb15a42987deb6620c4575c420002313af23 (patch)
tree541cc88566a9cac6f8bf473c31879bf536f71c5c /builtin-pack-objects.c
parenta5b2d4ac24ef18cf8c628e258bef8a20d9bf4b2b (diff)
parent3289b9dec56d34fe05f90c262d11adc0a61e16e7 (diff)
downloadgit-ecbbfb15a42987deb6620c4575c420002313af23.tar.gz
Merge branch 'bc/maint-keep-pack'
* bc/maint-keep-pack: t7700: test that 'repack -a' packs alternate packed objects pack-objects: extend --local to mean ignore non-local loose objects too sha1_file.c: split has_loose_object() into local and non-local counterparts t7700: demonstrate mishandling of loose objects in an alternate ODB builtin-gc.c: use new pack_keep bitfield to detect .keep file existence repack: do not fall back to incremental repacking with [-a|-A] repack: don't repack local objects in packs with .keep file pack-objects: new option --honor-pack-keep packed_git: convert pack_local flag into a bitfield and add pack_keep t7700: demonstrate mishandling of objects in packs with a .keep file
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 95e6faf1e6..59ae64d83f 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -71,6 +71,7 @@ static int reuse_delta = 1, reuse_object = 1;
static int keep_unreachable, unpack_unreachable, include_tag;
static int local;
static int incremental;
+static int ignore_packed_keep;
static int allow_ofs_delta;
static const char *base_name;
static int progress = 1;
@@ -698,6 +699,9 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
return 0;
}
+ if (!exclude && local && has_loose_object_nonlocal(sha1))
+ return 0;
+
for (p = packed_git; p; p = p->next) {
off_t offset = find_pack_entry_one(sha1, p);
if (offset) {
@@ -711,6 +715,8 @@ static int add_object_entry(const unsigned char *sha1, enum object_type type,
return 0;
if (local && !p->pack_local)
return 0;
+ if (ignore_packed_keep && p->pack_local && p->pack_keep)
+ return 0;
}
}
@@ -2056,6 +2062,10 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
incremental = 1;
continue;
}
+ if (!strcmp("--honor-pack-keep", arg)) {
+ ignore_packed_keep = 1;
+ continue;
+ }
if (!prefixcmp(arg, "--compression=")) {
char *end;
int level = strtoul(arg+14, &end, 0);