git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: type_size_sort

From
Junio C Hamano <junkio@cox.net>
Date
Dec 6, 2005, 21:45 UTC
Message-ID
<7vpso92940.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<118833cc0512061319l3726fdfbs8286e7b3f5ab0713@mail.gmail.com>
Morten Welinder <mwelinder@gmail.com> writes:
Show 8 quoted lines
> 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 {
Previous: Morten Welinder
Message 7 of 7 in “type_size_sort”
  1. Morten WelinderDec 6, 2005
  2. Andreas EricssonDec 6, 2005
  3. Junio C HamanoDec 6, 2005
  4. Morten WelinderDec 7, 2005
  5. Junio C HamanoDec 7, 2005
  6. Morten WelinderDec 7, 2005
  7. Junio C HamanoDec 6, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.