Martin Ågren <martin.ag...@gmail.com> writes:

> Bump `found` to the scope of the whole function and rearrange the "roll
> back or write?"-checks to a straightforward if-else on `found`. This
> also future-proves the code by making it obvious that we intend to take
> exactly one of these paths.
>
> Improved-by: Jeff King <p...@peff.net>
> Signed-off-by: Martin Ågren <martin.ag...@gmail.com>
> ---
> v2: Moved the rollback to the end to have an obvious if-else instead of
> retaining the original logic. Thanks Peff.

Yup, both are correct but this version is 10x easier to follow.
Thanks, both.

Reply via email to