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

[PATCH 2/9] pack-objects: equal objects in size should delta against newer objects

From
Nicolas Pitre <nico@cam.org>
Date
Apr 16, 2007, 16:28 UTC
Message-ID
<alpine.LFD.0.98.0704161228160.4504@xanadu.home>

Before finding best delta combinations, we sort objects by name hash, then by size, then by their position in memory. Then we walk the list backwards to test delta candidates.

We hope that a bigger size usually means a newer objects. But a bigger address in memory does not mean a newer object. So the last comparison must be reversed.

Signed-off-by: Nicolas Pitre <nico@cam.org>
---
 builtin-pack-objects.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 62a011e..869ca1a 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -1276,7 +1276,7 @@ static int type_size_sort(const struct object_entry *a, const struct object_entr
 		return -1;
 	if (a->size > b->size)
 		return 1;
-	return a < b ? -1 : (a > b);
+	return a > b ? -1 : (a < b);  /* newest last */
 }
 
 struct unpacked {
-- 
1.5.1.1.781.g65e8
Message 1 of 1 in “pack-objects: equal objects in size should delta against newer objects”
  1. 2/9 pack-objects: equal objects in size should delta against newer objectsNicolas Pitre, Apr 16, 2007

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.