Thread (11 messages) 11 messages, 4 authors, 2017-10-12

Re: [PATCH v4 4/4] sha1_name: minimize OID comparisons during disambiguation

From: Jeff King <hidden>
Date: 2017-10-10 13:09:26

Possibly related (same subject, not in this thread)

On Tue, Oct 10, 2017 at 09:56:38PM +0900, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
OK, I think that makes more sense. But note the p->num_objects thing I
mentioned. If I do:

  git pack-objects .git/objects/pack/pack </dev/null

then I have a pack with zero objects, which I think we'd similarly want
to return early from. I.e., I think we need:

  if (p->num_objects)
	return;

Technically that also covers open_pack_index() failure, too, but that's
a subtlety I don't think we should rely on.
True.  I notice that the early part of the two functions look almost
identical.  Do we need error condition handling for the other one,
too?
I'm not sure which two you mean. Do you mean find_pack_entry_one() in
packfile.c as the other one? If so, I think it is fine in the
zero-object case, because it does not do the "this is the sha1 at the
position where it _would_ be found" trick, which is what causes us to
potentially dereference nonsense.

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