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

[PATCH] fix index-pack with packs >4GB containing deltas on 32-bit machines

From
Nicolas Pitre <nico@cam.org>
Date
Nov 11, 2007, 04:29 UTC
Message-ID
<alpine.LFD.0.9999.0711102319470.21255@xanadu.home>

This probably hasn't been properly tested before. Here's a script to create a 8GB repo with the necessary characteristics (copy the test-genrandom executable from the Git build tree to /tmp first):

----- #!/bin/bash

git init git config core.compression 0

# create big objects with no deltas
for i in $(seq -w 1 2 63)
do
	echo $i
	/tmp/test-genrandom $i 268435456 > file_$i
	git add file_$i
	rm file_$i
	echo "file_$i -delta" >> .gitattributes
done
# create "deltifiable" objects in between big objects
for i in $(seq -w 2 2 64)
do
	echo "$i $i $i" >> grow
	cp grow file_$i
	git add file_$i
	rm file_$i
done
rm grow

# create a pack with them git commit -q -m "commit of big objects interlaced with small deltas" git repack -a -d -----

Then clone this repo over the Git protocol.
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
diff --git a/index-pack.c b/index-pack.c
index 469a330..9fd6982 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -256,7 +256,7 @@ static void *unpack_raw_entry(struct object_entry *obj, union delta_base *delta_
 
 static void *get_data_from_pack(struct object_entry *obj)
 {
-	unsigned long from = obj[0].idx.offset + obj[0].hdr_size;
+	off_t from = obj[0].idx.offset + obj[0].hdr_size;
 	unsigned long len = obj[1].idx.offset - from;
 	unsigned long rdy = 0;
 	unsigned char *src, *data;
Next: Junio C Hamano
Message 1 of 2 in “fix index-pack with packs >4GB containing deltas on 32-bit machines”
  1. fix index-pack with packs >4GB containing deltas on 32-bit machinesNicolas Pitre, Nov 11, 2007
  2. Junio C HamanoNov 11, 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.