git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] rebase -i: reread the todo list if `exec` touched it

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 27, 2017, 12:43 UTC
Message-ID
<alpine.DEB.2.20.1704271438290.3480@virtualbox>
In-Reply-To
<CAABDHWZdsbP_NYW36nXc7WwjZf53PeEQrfaCUQrDpU4Zd9R2ew@mail.gmail.com>
Hi Steve,
On Wed, 26 Apr 2017, Steve Hicks wrote:
Show 20 quoted lines
> On Wed, Apr 26, 2017 at 12:17 PM, Johannes Schindelin
> <johannes.schindelin@gmx.de> wrote:
> > From: Stephen Hicks <sdh@google.com>
> >
> > In the scripted version of the interactive rebase, there was no
> > internal representation of the todo list; it was re-read before every
> > command.  That allowed the hack that an `exec` command could append
> > (or even completely rewrite) the todo list.
> >
> > This hack was broken by the partial conversion of the interactive
> > rebase to C, and this patch reinstates it.
> >
> > We also add a small test to verify that this fix does not regress in
> > the future.
> 
> For context on this "hack", I have a script [1] that allows passing
> multiple branches at once (or all branches beneath a given root).  It
> rewrites the todo file with some extra operations, like "branch",
> "push", and "pop", allows editing the modified todo, and then rewrites
> back to exec's.

For what it's worth, I used a slightly different approach in the Git garden shears [*1*] (essentially, `git rebase -i -p` Done Right): I override the GIT_SEQUENCE_EDITOR to call the script in a specific mode that rewrites the todo and then launches the editor as per `git var GIT_EDITOR`.

Ciao, Johannes

Footnote *1*: https://github.com/git-for-windows/build-extra/blob/master/shears.sh

Previous: Steve Hicks
Message 3 of 3 in “rebase -i: reread the todo list if `exec` touched it”
  1. rebase -i: reread the todo list if `exec` touched itJohannes Schindelin, Apr 26, 2017
  2. Steve HicksApr 26, 2017
  3. Johannes SchindelinApr 27, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.