From: Linus Torvalds Date: Tue, 17 May 2005 15:29:37 GMT Subject: Re: [PATCH] Make object contents optionally available Message-ID: In-Reply-To: On Tue, 17 May 2005, Daniel Barkalow wrote: > > This adds contents and size fields to struct object. If unpack_object is > called on an object, it will fill in the contents field with the complete > raw contents of the object. If free_object_contents is called on an > object, the contents will be freed. If contents is filled when an object > is parsed, it is not unpacked an extra time, but the contents are not > retained if they were not unpacked before parsing. I really hate magic interfaces like that. It's just a bug waiting to happen. I'd actually prefer it if "parse_object()" just always unpacks it, and leaves the unpacked thing in memory. Then, the _few_ programs that really care about memory use because they parse potentially millions of objects (especially blobs, which obviously can be very large) can be updated to just do a manual "free_object_contents()". That's primarily things like fsck and convert-cache, I suspect. That would leave a lot less special cases and strange rules.. Linus