[PATCH] index-pack: correctly initialize appended objects

Subsystems: the rest

STALE3713d

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

[PATCH] index-pack: correctly initialize appended objects

From: Johannes Schindelin <hidden>
Date: 2016-06-15 22:45:00

From: Björn Steinbrink <redacted>

When index-pack completes a thin pack it appends objects to the pack.  
Since the commit 92392b4(index-pack: Honor core.deltaBaseCacheLimit when 
resolving deltas) such an object can be pruned in case of memory
pressure.

To be able to re-read the object later, a few more fields have to be set.

Noticed by Pierre Habouzit.

Hopefully-signed-off-by: Björn Steinbrink [off-list ref]
Hopefully-reviewed-and-signed-off-by: Nicolas Pitre [off-list ref], 

--

	This was probably missed in the flurry of patches, scratched 
	patches, and new patches.

	Nico could you have a quick look?  (I would ask Shawn, but I know 
	that he is pretty busy with real world issues.)
diff --git a/index-pack.c b/index-pack.c
index ac20a46..33ba8ef 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -699,6 +699,9 @@ static struct object_entry *append_obj_to_pack(
 	write_or_die(output_fd, header, n);
 	obj[0].idx.crc32 = crc32(0, Z_NULL, 0);
 	obj[0].idx.crc32 = crc32(obj[0].idx.crc32, header, n);
+	obj[0].hdr_size = n;
+	obj[0].type = type;
+	obj[0].size = size;
 	obj[1].idx.offset = obj[0].idx.offset + n;
 	obj[1].idx.offset += write_compressed(output_fd, buf, size, &obj[0].idx.crc32);
 	hashcpy(obj->idx.sha1, sha1);

Re: [PATCH] index-pack: correctly initialize appended objects

From: Björn Steinbrink <hidden>
Date: 2016-06-15 22:45:00

On 2008.07.24 18:32:00 +0100, Johannes Schindelin wrote:
From: Björn Steinbrink <redacted>

When index-pack completes a thin pack it appends objects to the pack.  
Since the commit 92392b4(index-pack: Honor core.deltaBaseCacheLimit when 
resolving deltas) such an object can be pruned in case of memory
pressure.

To be able to re-read the object later, a few more fields have to be set.
Ah, thanks a lot! I tried to come up with a sane commit message
yesterday but totally failed, and then after a night of sneezing, I had
forgotten about it. And I wouldn't have managed to write an equally good
message anyway ;-)
Noticed by Pierre Habouzit.

Hopefully-signed-off-by: Björn Steinbrink [off-list ref]
Sure!

Signed-off-by: Björn Steinbrink <redacted>

Thanks,
Björn

Re: [PATCH] index-pack: correctly initialize appended objects

From: Nicolas Pitre <hidden>
Date: 2016-06-15 22:45:02

On Thu, 24 Jul 2008, Johannes Schindelin wrote:
From: Björn Steinbrink <redacted>

When index-pack completes a thin pack it appends objects to the pack.  
Since the commit 92392b4(index-pack: Honor core.deltaBaseCacheLimit when 
resolving deltas) such an object can be pruned in case of memory
pressure.

To be able to re-read the object later, a few more fields have to be set.

Noticed by Pierre Habouzit.

Hopefully-signed-off-by: Björn Steinbrink [off-list ref]
Hopefully-reviewed-and-signed-off-by: Nicolas Pitre [off-list ref], 

--

	This was probably missed in the flurry of patches, scratched 
	patches, and new patches.

	Nico could you have a quick look?  (I would ask Shawn, but I know 
	that he is pretty busy with real world issues.)
sorry, I have intermitant connectivity this week, and I'll be off the 
net for two weeks after that.

Yes, this looks fine, although I'd add a comment mentioning that those 
extra fields are uninitialized in the thin pack case when objects are 
appended to the pack since they're already initialized otherwise.

ACK.


Nicolas
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help