Skip to content
  • Jeff King's avatar
    gc: do not explode objects which will be immediately pruned · 7e52f566
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When we pack everything into one big pack with "git repack
    -Ad", any unreferenced objects in to-be-deleted packs are
    exploded into loose objects, with the intent that they will
    be examined and possibly cleaned up by the next run of "git
    prune".
    
    Since the exploded objects will receive the mtime of the
    pack from which they come, if the source pack is old, those
    loose objects will end up pruned immediately. In that case,
    it is much more efficient to skip the exploding step
    entirely for these objects.
    
    This patch teaches pack-objects to receive the expiration
    information and avoid writing these objects out. It also
    teaches "git gc" to pass the value of gc.pruneexpire to
    repack (which in turn learns to pass it along to
    pack-objects) so that this optimization happens
    automatically during "git gc" and "git gc --auto".
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Acked-by: default avatarNicolas Pitre <nico@fluxnic.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    7e52f566