Subject: Re: [PATCH] revision.c: implement --reverse=before for walks

From: Jeff King <[email-masked]>
Date: Mon, 20 Apr 2026 23:48:16 -0400

On Mon, Apr 20, 2026 at 11:33:25AM +0200, Mirko Faina wrote:

> > But we should keep "--reverse --reverse" working as before, as there is
> > no other way to countermand a previously-given reverse option, and
> > because it has always worked.
> 
> What about a triple reverse? That would mean the original reverse choice
> is lost and it defaults to the historical "after", which I'm fine with,
> but this will need some extra caveat in the documentation :')

If "--reverse" means "reverse after", then:

  --reverse=before --reverse --reverse

is back to reversing after. You could also make it retain before/after
if you stored that as a separate bit. I.e.,:

  reverse=before:
    revs->reverse = 1;
    revs->reverse_when = REVERSE_BEFORE;
  reverse=after:
    revs->reverse = 1;
    revs->reverse_when = REVERSE_AFTER;
  reverse:
    revs->reverse ^= 1; /* flip reversing */
    /* do not touch reverse_when! */

And then the triple-reverse takes you back to reverse=before. I'm not
sure if that is more or less confusing, though. ;)

At any rate, I agree that the behavior should be mentioned in the docs,
especially since "--reverse" is not a true synonym for "--reverse=after"
because of the override vs negation behavior.

-Peff