refs.c: add a function to sort a ref list, rather then sorting on add
commitc774aab98ce6c5ef7aaacbef38da0a501eb671d4
authorJulian Phillips <julian@quantumfyre.co.uk>
Tue, 17 Apr 2007 01:42:50 +0000 (17 02:42 +0100)
committerJunio C Hamano <junkio@cox.net>
Wed, 18 Apr 2007 23:20:57 +0000 (18 16:20 -0700)
treea3b39d2c91b4a506b9d490ead8faf0b812096ab1
parent6fb8e8f401a065bdffe379764871551e37a041a0
refs.c: add a function to sort a ref list, rather then sorting on add

Rather than sorting the refs list while building it, sort in one
go after it is built using a merge sort.  This has a large
performance boost with large numbers of refs.

It shouldn't happen that we read duplicate entries into the same
list, but just in case sort_ref_list drops them if the SHA1s are
the same, or dies, as we have no way of knowing which one is the
correct one.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
refs.c