Re: [PATCH 0/1] replay: add --revert option to reverse commit changes
- From
Elijah Newren <newren@gmail.com>
- Date
- Nov 28, 2025, 17:07 UTC
- Message-ID
- <CABPp-BF48AF9qoP_pUs1X=sUV-_G5BpsxnG6AEhQYkJkE_TBjA@mail.gmail.com>
- In-Reply-To
- <xmqq7bvajesl.fsf@gitster.g>
On Fri, Nov 28, 2025 at 8:35 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 33 quoted lines
> > Siddharth Asthana <siddharthasthana31@gmail.com> writes: > > > Agreed. I will keep the current submission focused on basic --revert > > functionality. Supporting --no-walk for disconnected commits (benefiting > > both --advance and --revert) would make a nice follow-up series. > > If we want to have a useful support for disconnected set of commits, > "--no-walk" is not the way to go, I would say. > > Imagine "among the 7-patch topic merged, the second commit (i.e., > topic~5) and the final 3 (i.e., topic~3..topic) need to go". You'd > want to be able to say (without going into details of the syntax) > > revert topic~5 topic~3..topic > > The setup_revisions() parser is still the right thing to use to > parse the command line arguments and pick out "topic~5" and > "topic~3..topic", but instead of letting prepare_revision_walk() > turn them into a single contiguous set of revisions, you'd need to > check revs->cmdline->rev[] and > > (1) treat singleton as its own disconnected island that require no > walking, > > (2) treat A..B as a range and independently walk them, and > > (3) dedup the result from cmdline->rev[] elements into a set of > commits that are potentially disconnected. > > I agree 100% that this topic should not attempt to deal with a > disconnected set of commits. That can and should be done as a > separate series.
How does one distinguish the "topic~5" in the range "topic~5 topic~3..topic" from * the topic~5 in "^topic~7 topic~5" * the "topic1" and "topic2" in "^$OLD_COMMIT --ancestry-path topic1 topic2" ? I kind of think we still need some kind of flag (possibly implied by default for --advance and --revert but not for --onto?), though I agree it'd need to be a new one rather than --no-walk for your example to work.
And if one can do this, should this flag also be added to other commands, so that e.g. `git log <someflag> topic~5 topic~3..topic" would also show the commits in topic~3..topic plus topic~5?