Web lists-archives.com

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

Hi Junio,

On Tue, 16 May 2017, Junio C Hamano wrote:

> The point of rewriting things in C and using run_command() interface was
> to avoid shell overhead.

That statement is missing the point.

It is true that converting shell scripts to proper builtins avoids the
shell overhead.

It is even more true that that results in a nice speed-up that can even be
felt on Linux (I feel I have to stress this, as you seem to be mostly
focused on Linux usage, and I do not want you to get the impression that
you are only doing "the Windows folks" a favor when you gracefully accept
the patches to convert scripts to proper builtins).

But the real truth is: shell scripting is not portable.

Shell scripting is never only shell scripting, of course. A quite
undocumented set of utilities is expected to be present for our scripts to
run, too: sed, awk, tr, cat, expr, just to name a few.

It does not end there. For example, sed is not equal to sed. BSD sed has
different semantics than GNU sed, and we jump through hoops to try to
ensure that our shell scripts run with both versions. Which must make many
a contributor feel a lot less positive about their contributions e.g. when
a reviewer points out that their \t in their sed statement would break Git
on MacOSX. Sad!

We place a burden on maintainers targeting platforms that are not Linux.
If I remember correctly, we need to override the default shell on one
Unix, even, because we simply failed to make our shell scripts run with

And then, of course, there are all the problems inflicted on users on that
most prevalent Operating System of them all: Windows. Yes, I know, you
"non-Windows folk" would like to happily ignore that little tiny problem,
but that's really doing Git a disservice. So stop doing it.

What hurts me most about this is that Subversion, a software that us "Git
folk" pride ourselves in making obsolete, never had those problems. It was
designed with an eye toward portability from the start.

It is a good thing to support users who want to automate their workflows
using scripts, of course. Oh, and please, do not forget to remember that
there are tons of scripting languages out there, e.g. AppleScript,
Javascript, Tcl, Python, Ruby; just because you prefer Bash does not mean
the majority of developers do.

So let's continue to broaden our scripting support. And at the same time,
let's also change our mindset so that we can reduce the portability
problems of Git.