Skip to content
  • Derrick Stolee's avatar
    remote: make add_missing_tags() linear · 85daa01f
    Derrick Stolee authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    The add_missing_tags() method currently has quadratic behavior.
    This is due to a linear number (based on number of tags T) of
    calls to in_merge_bases_many, which has linear performance (based
    on number of commits C in the repository).
    
    Replace this O(T * C) algorithm with an O(T + C) algorithm by
    using get_reachable_subset(). We ignore the return list and focus
    instead on the reachable_flag assigned to the commits we care
    about, because we need to interact with the tag ref and not just
    the commit object.
    
    Signed-off-by: default avatarDerrick Stolee <dstolee@microsoft.com>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    85daa01f