From: Junio C Hamano Date: Tue, 06 Dec 2005 21:45:03 GMT Subject: Re: type_size_sort Message-ID: <7vpso92940.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <118833cc0512061319l3726fdfbs8286e7b3f5ab0713@mail.gmail.com> Morten Welinder writes: > static int type_size_sort(const struct object_entry *a, const struct > object_entry *b) > { > ... > return a < b ? -1 : (a > b); > } > > This does not look valid. Then something like this? --- diff --git a/pack-objects.c b/pack-objects.c index a62c9f8..c27fee5 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -296,7 +296,7 @@ static int type_size_sort(const struct o return -1; if (a->size > b->size) return 1; - return a < b ? -1 : (a > b); + return memcmp(a->sha1, b->sha1, 20); } struct unpacked {