From: Phillip Wood Date: Fri, 20 Apr 2018 09:39:38 GMT Subject: Re: [PATCH v7 06/17] sequencer: introduce new commands to reset the revision Message-ID: In-Reply-To: <77c08b61387057af1be57c2b50769651cc8ec898.1524139900.git.johannes.schindelin@gmx.de> On 19/04/18 13:20, Johannes Schindelin wrote: > In the upcoming commits, we will teach the sequencer to rebase merges. > This will be done in a very different way from the unfortunate design of > `git rebase --preserve-merges` (which does not allow for reordering > commits, or changing the branch topology). > > The main idea is to introduce new todo list commands, to support > labeling the current revision with a given name, resetting the current > revision to a previous state, and merging labeled revisions. > > This idea was developed in Git for Windows' Git garden shears (that are > used to maintain Git for Windows' "thicket of branches" on top of > upstream Git), and this patch is part of the effort to make it available > to a wider audience, as well as to make the entire process more robust > (by implementing it in a safe and portable language rather than a Unix > shell script). > > This commit implements the commands to label, and to reset to, given > revisions. The syntax is: > > label > reset > > Internally, the `label ` command creates the ref > `refs/rewritten/`. This makes it possible to work with the labeled > revisions interactively, or in a scripted fashion (e.g. via the todo > list command `exec`). > > These temporary refs are removed upon sequencer_remove_state(), so that > even a `git rebase --abort` cleans them up. > > We disallow '#' as label because that character will be used as separator > in the upcoming `merge` command. > > Later in this patch series, we will mark the `refs/rewritten/` refs as > worktree-local, to allow for interactive rebases to be run in parallel in > worktrees linked to the same repository. > > As typos happen, a failed `label` or `reset` command will be rescheduled > immediately. Note that this needs a little change in the original code to > perform a reschedule: there is no commit from which to generate a patch > here (and we will simply fall through to the regular `return res`). We > keep that code path, though, because we will use it for the upcoming > `merge` command, too. > > Signed-off-by: Johannes Schindelin > --- > git-rebase--interactive.sh | 2 + > sequencer.c | 201 +++++++++++++++++++++++++++++++++++-- > 2 files changed, 196 insertions(+), 7 deletions(-) > > diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh > index e1b865f43f2..e8d3a7d7588 100644 > --- a/git-rebase--interactive.sh > +++ b/git-rebase--interactive.sh > @@ -162,6 +162,8 @@ s, squash = use commit, but meld into previous commit > f, fixup = like \"squash\", but discard this commit's log message > x, exec = run command (the rest of the line) using shell > d, drop = remove commit > +l, label