Re: [PATCH] Handle deltified object correctly in git-*-pull family.
- From
Linus Torvalds <torvalds@osdl.org>
- Date
- Jun 2, 2005, 00:58 UTC
- Message-ID
- <Pine.LNX.4.58.0506011738080.1876@ppc970.osdl.org>
- In-Reply-To
- <7v1x7lk8fl.fsf_-_@assigned-by-dhcp.cox.net>
On Wed, 1 Jun 2005, Junio C Hamano wrote:
Show 5 quoted lines
> > *** Linus, I have a hook in sha1_file.c to let me figure out the > *** size of the SHA1 file without fully expanding it. This > *** patch does not use it, but you already know where I am > *** heading, so please leave it there ;-).
Argh. This is just adding conceptual complexity without any real advantage.
Why not just split out the current "unpack_sha1_file()" into two stages: "unpack_sha1_header()" and the rest.
Then you can just decide to call "unpack_sha1_header()" when you want the header information.
Hmm. I just committed something like that. If you want to just see the type of an object, you can map the object in memory, and just do
z_stream stream; char buffer[100];
if (unpack_sha1_header(&stream, map, mapsize, buffer, sizeof(buffer) < 0) return NULL; if (sscanf(buffer, %10s %lu", type, size) != 0) return NULL; .. there you have it ..
which is a lot simpler than worrying about callbacks etc.
Linus