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>
Jeff King committed
Oct 16, 2014 at 20:44 UTC
b1e757f36377df1f2a6c165ebf171b09a8ad957b
1 file changed
+2
builtin/pack-objects.c
+2
@@ -2757,6 +2757,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
2757
2758
if (keep_unreachable && unpack_unreachable)
2759
die("--keep-unreachable and --unpack-unreachable are incompatible.");
2760
+ if (!rev_list_all || !rev_list_reflog || !rev_list_index)
2761
+ unpack_unreachable_expiration = 0;
2762
2763
if (!use_internal_rev_list || !pack_to_stdout || is_repository_shallow())
2764
use_bitmap_index = 0;