prune_refs(): use delete_refs()
commita087b432a79f85b34e8582219a0bdec73c5821f5
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 22 Jun 2015 14:02:59 +0000 (22 16:02 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Jun 2015 20:17:10 +0000 (22 13:17 -0700)
treea6ff333e0564f36a893d504cf03919131e51be9a
parenta122366d6946ea41ac8167a88f1949416008decb
prune_refs(): use delete_refs()

The old version just looped over the references to delete, calling
delete_ref() on each one. But that has quadratic behavior, because
each call to delete_ref() might have to rewrite the packed-refs file.
This can be very expensive in a repository with a large number of
references. In some (admittedly extreme) repositories, we've seen
cases where the ref-pruning part of fetch takes multiple tens of
minutes.

Instead call delete_refs(), which (aside from being less code) has the
optimization that it only rewrites the packed-refs file a single time.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch.c