summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-10-17 00:44:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-19 22:07:07 (GMT)
commitb1e757f36377df1f2a6c165ebf171b09a8ad957b (patch)
tree06aa8d88ce27396ab313a47980356536ede59758 /builtin/pack-objects.c
parentc90f9e13abae630551ada3e895633bdc2cf4e080 (diff)
downloadgit-b1e757f36377df1f2a6c165ebf171b09a8ad957b.zip
git-b1e757f36377df1f2a6c165ebf171b09a8ad957b.tar.gz
git-b1e757f36377df1f2a6c165ebf171b09a8ad957b.tar.bz2
pack-objects: double-check options before discarding objects
When we are given an expiration time like --unpack-unreachable=2.weeks.ago, we avoid writing out old, unreachable loose objects entirely, under the assumption that running "prune" would simply delete them immediately anyway. However, this is only valid if we computed the same set of reachable objects as prune would. In practice, this is the case, because only git-repack uses the --unpack-unreachable option with an expiration, and it always feeds as many objects into the pack as possible. But we can double-check at runtime just to be sure. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 0cf95c9..64123d4 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -2757,6 +2757,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
if (keep_unreachable && unpack_unreachable)
die("--keep-unreachable and --unpack-unreachable are incompatible.");
+ if (!rev_list_all || !rev_list_reflog || !rev_list_index)
+ unpack_unreachable_expiration = 0;
if (!use_internal_rev_list || !pack_to_stdout || is_repository_shallow())
use_bitmap_index = 0;