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

2017-04-27 Thread Johannes Schindelin
Hi Steve,

On Wed, 26 Apr 2017, Steve Hicks wrote:

> On Wed, Apr 26, 2017 at 12:17 PM, Johannes Schindelin
>  wrote:
> > From: Stephen Hicks 
> >
> > 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


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

2017-04-26 Thread Steve Hicks
On Wed, Apr 26, 2017 at 12:17 PM, Johannes Schindelin
 wrote:
> From: Stephen Hicks 
>
> 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.
>
> Signed-off-by: Stephen Hicks 
> Signed-off-by: Johannes Schindelin 

Thanks for shepherding this through, Johannes!

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.  The "branch" operation, in particular, appends an
"exec git checkout $branch; git reset --hard $commit" to the end of
the todo, so that no branches are moved until after all rebases are
successful.  I've found this multi-branch rebase workflow to be very
productive, and have been missing it the last few months, so I'm
looking forward to it working again soon.

[1] https://github.com/shicks/git-ir