{"thread":{"id":"10794","subject":"[PATCH] fix index-pack with packs >4GB containing deltas on 32-bit machines","startedAt":"2007-11-11T04:29:10Z","lastAt":"2007-11-11T21:25:21Z","messageCount":2,"participants":["Nicolas Pitre","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"59260","messageId":"alpine.LFD.0.9999.0711102319470.21255@xanadu.home","threadId":"10794","inReplyTo":null,"subject":"[PATCH] fix index-pack with packs >4GB containing deltas on 32-bit machines","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-11-11T04:29:10Z","receivedAt":"2007-11-11T04:29:10Z","isPatch":true,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"This probably hasn't been properly tested before.  Here's a script to \ncreate a 8GB repo with the necessary characteristics (copy the \ntest-genrandom executable from the Git build tree to /tmp first):\n\n-----\n#!/bin/bash\n\ngit init\ngit config core.compression 0\n\n# create big objects with no deltas\nfor i in $(seq -w 1 2 63)\ndo\n\techo $i\n\t/tmp/test-genrandom $i 268435456 > file_$i\n\tgit add file_$i\n\trm file_$i\n\techo \"file_$i -delta\" >> .gitattributes\ndone\n\n# create \"deltifiable\" objects in between big objects\nfor i in $(seq -w 2 2 64)\ndo\n\techo \"$i $i $i\" >> grow\n\tcp grow file_$i\n\tgit add file_$i\n\trm file_$i\ndone\nrm grow\n\n# create a pack with them\ngit commit -q -m \"commit of big objects interlaced with small deltas\"\ngit repack -a -d\n-----\n\nThen clone this repo over the Git protocol.\n\nSigned-off-by: Nicolas Pitre <nico@cam.org>\n---\ndiff --git a/index-pack.c b/index-pack.c\nindex 469a330..9fd6982 100644\n--- a/index-pack.c\n+++ b/index-pack.c\n@@ -256,7 +256,7 @@ static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_\n \n static void *get_data_from_pack(struct object_entry *obj)\n {\n-\tunsigned long from = obj[0].idx.offset + obj[0].hdr_size;\n+\toff_t from = obj[0].idx.offset + obj[0].hdr_size;\n \tunsigned long len = obj[1].idx.offset - from;\n \tunsigned long rdy = 0;\n \tunsigned char *src, *data;\n"},{"id":"59381","messageId":"7v8x54cw5a.fsf@gitster.siamese.dyndns.org","threadId":"10794","inReplyTo":"alpine.LFD.0.9999.0711102319470.21255@xanadu.home","subject":"Re: [PATCH] fix index-pack with packs >4GB containing deltas on 32-bit machines","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-11-11T21:25:21Z","receivedAt":"2007-11-11T21:25:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Looks obviously correct.  Thanks.\n"}]}