Re: [PATCH] has_sha1_file: re-check pack directory before giving up
- From
Jeff King <peff@peff.net>
- Date
- Aug 30, 2013, 04:28 UTC
- Message-ID
- <20130830042801.GA23780@sigill.intra.peff.net>
- In-Reply-To
- <20130830011052.GA21895@sigill.intra.peff.net>
On Thu, Aug 29, 2013 at 09:10:52PM -0400, Jeff King wrote:
Show 5 quoted lines
> In the case of git-fsck, which uses the > DO_FOR_EACH_INCLUDE_BROKEN flag, this will cause us to > erroneously complain that the ref points to an invalid > object. But for git-repack, which does not use that flag, we > will skip the ref completely!
Hmm. This is slightly inaccurate. fsck does not use INCLUDE_BROKEN, and that is why it recognizes (and prints the warning) the "broken" ref. pack-objects would also print a warning, but would dutifully ignore the broken ref during the repack.
So it is actually something like for-each-ref, which _does_ use INCLUDE_BROKEN, that behaves differently. And it tends to work, because it ends up calling read_sha1_file to find out about the file rather than checking has_sha1_file.
-Peff