• Show log

    Commit

  • Hash : 8c773438
    Author : Patrick Steinhardt
    Date : 2019-02-15T10:15:39

    refdb_fs: fix potential race with ref repacking in `exists` callback
    
    When repacking references, git.git will first update the packed refs and only
    afterwards delete any existing loose references that have now been moved to the
    new packed refs file. Due to this, there is a potential for racing if one first
    reads the packfile (which has not been updated yet) and only then trying to read
    the loose reference (which has just been deleted). In this case, one will
    incorrectly fail to lookup the reference and it will be reported as missing.
    Naturally, this is exactly what we've been doing in `refdb_fs_backend__exists`.
    
    Fix the race by reversing the lookup: we will now first check if the loose
    reference exists and only afterwards refresh the packed file.