]> git.ipfire.org Git - thirdparty/git.git/commit
diffcore-rename: allow different missing_object_cb functions
authorElijah Newren <newren@gmail.com>
Tue, 22 Jun 2021 08:04:39 +0000 (08:04 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 28 Jun 2021 14:58:25 +0000 (07:58 -0700)
commitd331dd3b0c829fe9019f0113a095ed95bc06f227
tree0ecfb755c3662041ec5a8087c237c31afdd546c5
parentc75c42395267f3b484f47404ae746d323586a929
diffcore-rename: allow different missing_object_cb functions

estimate_similarity() was setting up a diff_populate_filespec_options
every time it was called, requiring the caller of estimate_similarity()
to pass in some data needed to set up this option.  Currently the needed
data consisted of a single variable (skip_unmodified), but we want to
also have the different estimate_similarity() callsites start using
different missing_object_cb functions as well.  Rather than also passing
that data in, just have the caller pass in the whole
diff_populate_filespec_options, and reduce the number of times we need to
set it up.

As a side note, this also drops the number of calls to
has_promisor_remote() dramatically.  If L is the number of basename
paths to compare, M is the number of inexact sources, and N is the
number of inexact destinations, then the number of calls to
has_promisor_remote() drops from L+M*N down to at most 2 -- one for each
of the sites that calls estimate_similarity().  has_promisor_remote() is
a very fast function so this almost certainly has no measurable
performance impact, but it seems cleaner to avoid calling that function
so many times.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-rename.c