Skip to content
  • Junio C Hamano's avatar
    fetch/receive: remove over-pessimistic connectivity check · d21c463d
    Junio C Hamano authored
    
    
    Git 1.7.8 introduced an object and history re-validation step after
    "fetch" or "push" causes new history to be added to a receiving
    repository. This is to protect a malicious server or pushing client from
    corrupting the repository by taking advantage of an existing corrupt
    object that is unconnected to existing history.
    
    But this check is way over-pessimistic.  During "fetch" or "receive-pack"
    (the server side of "push"), unpack-objects and index-pack already
    validate individual objects that are received, and the only thing we would
    want to catch are corrupted objects that already happen to exist in our
    repository but are not referenced from our refs.  Such objects must have
    been written by an earlier run of our codepaths that write out loose
    objects or packfiles, and they must have done the validation of individual
    objects when they did so.  The only thing left to worry about is the
    connectivity integrity, which can be checked with "rev-list --objects",
    which is much cheaper.  We have been paying the 5x to 8x runtime overhead
    the --verify-objects often adds for no real gain.
    
    Revert check_everything_connected() not to use this over-pessimistic
    check.
    
    Credit goes to Nguyễn Thái Ngọc Duy, who originally identified the
    performance regression and endured multiple rounds of reviews to fix it.
    
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    d21c463d