fetch-pack: avoid quadratic loop in filter_refs
commita0de28805dceaca86a6f7bedfd3e8c227b781d9d
authorJeff King <peff@peff.net>
Mon, 21 May 2012 22:23:29 +0000 (21 18:23 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 May 2012 20:31:03 +0000 (22 13:31 -0700)
treedce1eb8189354e5cb2b3d97e3e59fb60cc52a0bb
parent9e8e704f0bc14da325aa63f639c6dc782c81e26f
fetch-pack: avoid quadratic loop in filter_refs

We have a list of refs that we want to compare against the
"match" array. The current code searches the match list
linearly, giving quadratic behavior over the number of refs
when you want to fetch all of them.

Instead, we can compare the lists as we go, giving us linear
behavior.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch-pack.c