remote: make add_missing_tags() linear
commit85daa01f6b80cb6eb14c5f484a6da9f0b1247143
authorDerrick Stolee <dstolee@microsoft.com>
Fri, 2 Nov 2018 13:14:49 +0000 (2 06:14 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Nov 2018 15:12:06 +0000 (3 00:12 +0900)
tree93a59bf1f2dba5246c12610c4fac0678e4b0ccd7
parent4c7bb45269ccd1fdb15347a675ff16e8a8534f68
remote: make add_missing_tags() linear

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: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c