• Show log

    Commit

  • Hash : 83333814
    Author : Patrick Steinhardt
    Date : 2019-02-15T10:56:50

    refdb_fs: do not lazily copy packed ref cache
    
    When creating a new iterator, we eagerly load loose refs but only lazily create
    a copy of packed refs. The lazy load only happens as soon as we have iterated
    over all loose refs, opening up a potentially wide window for races. This
    may lead to an inconsistent view e.g. when the caller decides to reload packed
    references somewhen between iterating the loose refs, which is unexpected.
    
    Fix the issue by eagerly copying the sorted cache. Note that right now, we are
    heavily dependent on ordering here: we first need to reload packed refs, then we
    have to load loose refs and only as a last step are we allowed to copy the
    cache. This is because loading loose refs has the side-effect of setting the
    `PACKED_SHADOWED` flag in the packed refs cache, which we require to avoid
    outputting packed refs that already exist as loose refs.