Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Handle deltified object correctly in git-*-pull family.

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:41:59


On Wed, 1 Jun 2005, Junio C Hamano wrote:
*** 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help