Re: [PATCH] Fix "unpack-objects --strict"
- From
Frank Lichtenheld <frank@lichtenheld.de>
- Date
- Aug 14, 2009, 09:30 UTC
- Message-ID
- <20090814093027.GA14475@mail-vs.djpig.de>
- In-Reply-To
- <7vd46zbjae.fsf@alter.siamese.dyndns.org>
On Thu, Aug 13, 2009 at 12:33:45PM -0700, Junio C Hamano wrote:
Show 16 quoted lines
> When unpack-objects is run under the --strict option, objects that have > pointers to other objects are verified for the reachability at the end, by > calling check_object() on each of them, and letting check_object to walk > the reachable objects from them using fsck_walk() recursively. > > The function however misunderstands the semantics of fsck_walk() function > when it makes a call to it, setting itself as the callback. fsck_walk() > expects the callback function to return a non-zero value to signal an > error (negative value causes an immediate abort, positive value is still > an error but allows further checks on sibling objects) and return zero to > signal a success. The function however returned 1 on some non error > cases, and to cover up this mistake, complained only when fsck_walk() did > not detect any error. > > To fix this double-bug, make the function return zero on all success > cases, and also check for non-zero return from fsck_walk() for an error.
I've applied this patch and your small follow-up patch here and the error indeed disappears. I can't comment on the semantical correctness of the patch.
Thanks,
-- Frank Lichtenheld <frank@lichtenheld.de> www: http://www.djpig.de/