Skip to content
  • Jeff King's avatar
    receive-pack: quarantine objects until pre-receive accepts · 722ff7f8
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    When a client pushes objects to us, index-pack checks the
    objects themselves and then installs them into place. If we
    then reject the push due to a pre-receive hook, we cannot
    just delete the packfile; other processes may be depending
    on it. We have to do a normal reachability check at this
    point via `git gc`.
    
    But such objects may hang around for weeks due to the
    gc.pruneExpire grace period. And worse, during that time
    they may be exploded from the pack into inefficient loose
    objects.
    
    Instead, this patch teaches receive-pack to put the new
    objects into a "quarantine" temporary directory. We make
    these objects available to the connectivity check and to the
    pre-receive hook, and then install them into place only if
    it is successful (and otherwise remove them as tempfiles).
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    722ff7f8