Re: [PATCH 2/4] commit-graph: verify swapped zero/non-zero generation cases
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Aug 11, 2023, 17:08 UTC
- Message-ID
- <ZNZq/25LhQfXdo2+@nand.local>
- In-Reply-To
- <20230811150114.GC2303200@coredump.intra.peff.net>
On Fri, Aug 11, 2023 at 11:01:14AM -0400, Jeff King wrote:
Show 24 quoted lines
> > Hmph, doesn't this potentially cause us to emit the two reports
> > alternating, if we are unlucky enough to see a commit with 0
> > generation first (which will silently set gz to ZERO_EXISTS), then
> > another commit with non-zero generation (which will complain we saw
> > non-zero for the current one and earlier we saw zero elsewhere, and
> > then set gz to NUM_EXISTS), and then another commit with 0
> > generation (which will complain the other way, and set gz back again
> > to ZERO_EXISTS)?
> >
> > I am tempted to say this gz business should be done with two bits
> > (seen zero bit and seen non-zero bit), and immediately after we see
> > both kinds, we should report once and stop making further reports,
> > but ...
>
> Yeah, I think you are right. It might be OK, in the sense that we would
> show a different commit each time as we flip-flopped, but it's not clear
> to me how valuable that is.
>
> If the actual commit ids are not valuable, then we could just set bits
> and then at the end of the loop produce one warning:
>
> if (seen_zero && seen_non_zero) {
> graph_report("oops, we saw both types");
> }Thanks, both. I think that this is a very reasonable suggestion and an improvement on the existing reporting. I made this change and sent the revised series as a v2 lower down in the thread.
Thanks, Taylor