{"thread":{"id":"7683","subject":"[PATCH 2/9] pack-objects: equal objects in size should delta against newer objects","startedAt":"2007-04-16T16:14:51Z","lastAt":"2007-04-16T16:14:51Z","messageCount":1,"participants":["Nicolas Pitre"],"isPatch":true,"patchVersion":1,"patchTotal":9},"messages":[{"id":"39538","messageId":"S1030820AbXDPQOy/20070416161454Z+1495@vger.kernel.org","threadId":"7683","inReplyTo":null,"subject":"[PATCH 2/9] pack-objects: equal objects in size should delta against newer objects","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-04-16T16:14:51Z","receivedAt":"2007-04-16T16:14:51Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"Before finding best delta combinations, we sort objects by name hash,\nthen by size, then by their position in memory.  Then we walk the list\nbackwards to test delta candidates.\n\nWe hope that a bigger size usually means a newer objects.  But a bigger\naddress in memory does not mean a newer object.  So the last comparison\nmust be reversed.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n---\n builtin-pack-objects.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-pack-objects.c b/builtin-pack-objects.c\nindex 62a011e..869ca1a 100644\n--- a/builtin-pack-objects.c\n+++ b/builtin-pack-objects.c\n@@ -1276,7 +1276,7 @@ static int type_size_sort(const struct object_entry *a, const struct object_entr\n \t\treturn -1;\n \tif (a->size > b->size)\n \t\treturn 1;\n-\treturn a < b ? -1 : (a > b);\n+\treturn a > b ? -1 : (a < b);  /* newest last */\n }\n \n struct unpacked {\n-- \n1.5.1.1.781.g65e8\n"}]}