From 838cd34664422863096f1a089f779bed1f00edf6 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Thu, 9 Oct 2008 22:08:51 -0400 Subject: fix pread()'s short read in index-pack Since v1.6.0.2~13^2~ the completion of a thin pack uses sha1write() for its ability to compute a SHA1 on the written data. This also provides data buffering which, along with commit 92392b4a45, will confuse pread() whenever an appended object is 1) freed due to memory pressure because of the depth-first delta processing, and 2) needed again because it has many delta children, and 3) its data is still buffered by sha1write(). Let's fix the issue by simply forcing cached data out when such an object is written so it can be pread()'d at leisure. Signed-off-by: Nicolas Pitre Signed-off-by: Shawn O. Pearce --- index-pack.c | 1 + 1 file changed, 1 insertion(+) (limited to 'index-pack.c') diff --git a/index-pack.c b/index-pack.c index c45ae20e8f..2a366206a4 100644 --- a/index-pack.c +++ b/index-pack.c @@ -707,6 +707,7 @@ static struct object_entry *append_obj_to_pack(struct sha1file *f, obj[1].idx.offset = obj[0].idx.offset + n; obj[1].idx.offset += write_compressed(f, buf, size); obj[0].idx.crc32 = crc32_end(f); + sha1flush(f); hashcpy(obj->idx.sha1, sha1); return obj; } -- cgit v1.2.1