On Tue, Jan 16, 2024 at 04:18:42PM +0200, Nikolay Borisov wrote: > The shell used when using the -x option is the one pointed to by the > SHELL_PATH constant at build time. This erroneous statement in the > documentation sent me on a 10 minute wild goose chase wondering why my > $SHELL was pointing to /bin/bash and my /bin/sh to dash and git was > using dash and not bash. Good catch. It originally used $SHELL when the documentation was added in cd035b1cef (rebase -i: add exec command to launch a shell command, 2010-08-10). But that was lost when it was converted to C (which is perhaps a regression, but nobody seems to have noticed or cared until now, and at this point we should stick with the new behavior). (I don't have an exact date since the conversion was somewhat piecemeal, but it was done by 2018). Since then, we use the code in run-command.c's prepare_shell_cmd(). > diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt > index 25516c45d8b8..08cf52daf39e 100644 > --- a/Documentation/git-rebase.txt > +++ b/Documentation/git-rebase.txt > @@ -964,7 +964,7 @@ non-0 status) to give you an opportunity to fix the problem. You can > continue with `git rebase --continue`. > > The "exec" command launches the command in a shell (the one specified > -in `$SHELL`, or the default shell if `$SHELL` is not set), so you can > +by the build-time SHELL_PATH variable, usually /bin/sh), so you can > use shell features (like "cd", ">", ";" ...). The command is run from > the root of the working tree. Avoiding $SHELL is obviously correct, but I think mentioning SHELL_PATH is a little hairy. It is not used on Windows; see 776297548e (Do not use SHELL_PATH from build system in prepare_shell_cmd on Windows, 2012-04-17). Maybe it makes sense to just say: ...in a shell (the default one, usually /bin/sh), ... It might even make sense to just drop the parenthetical phrase entirely. Git executes lots of things using a shell, and it is always "the default one", but we don't bother saying so in most places. -Peff