git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Morten Welinder <mwelinder@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: type_size_sort
Date: Tue, 06 Dec 2005 13:45:03 -0800	[thread overview]
Message-ID: <7vpso92940.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <118833cc0512061319l3726fdfbs8286e7b3f5ab0713@mail.gmail.com> (Morten Welinder's message of "Tue, 6 Dec 2005 16:19:21 -0500")

Morten Welinder <mwelinder@gmail.com> 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 {

      parent reply	other threads:[~2005-12-06 21:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-06 21:19 type_size_sort Morten Welinder
2005-12-06 21:38 ` type_size_sort Andreas Ericsson
2005-12-06 21:46   ` type_size_sort Junio C Hamano
2005-12-07  0:51   ` type_size_sort Morten Welinder
2005-12-07  2:28     ` type_size_sort Junio C Hamano
2005-12-07  3:01       ` type_size_sort Morten Welinder
2005-12-06 21:45 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vpso92940.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=mwelinder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).