Web lists-archives.com

Re: git rebase regression: cannot pass a shell expression directly to --exec




On Tue, May 16, 2017 at 12:23:02PM +0200, Johannes Schindelin wrote:

> On Mon, 15 May 2017, Eric Rannaud wrote:
> 
> > It used to be possible to run a sequence like:
> > 
> >   foo() { echo X; }
> >   export -f foo
> >   git rebase --exec foo HEAD~10
> 
> It would appear to me that you used a side effect of an implementation
> detail: that `git rebase -i` was implemented entirely as a shell script.

I don't think that's true at all. He expected the user-provided "--exec"
command to be run by a shell, which seems like a reasonable thing for
Git to promise (and we already make a similar promise for most
user-provided commands that we run).  What happens in between, be it
shell or C code, doesn't matter, and the conversion away from a shell
script in this case only tickled an existing bad interaction between
"export -f" and Git's run-command code.

See my other replies for the full story.

I don't think this has anything in particular to do with git-rebase,
though. Our solutions are either:

  - declare "export -f" as too tricky for our optimization, and teach
    people about the ";" trick

  - figure out some workaround/fallback to disable the shell-skipping
    optimization in this case

-Peff