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

Re: Change Native Windows shell

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 8, 2020, 17:39 UTC
Message-ID
<nycvar.QRO.7.76.6.2006081935530.482@ZVAVAG-DN14RQO.ybpnyqbznva>
In-Reply-To
<CAAXzdLVk3jLzuB2vgKGObQDjPydpdiawKJJ+-NMa376Gu1zt1A@mail.gmail.com>
Hi Steven,
On Thu, 4 Jun 2020, Steven Penny wrote:
Show 31 quoted lines
> On Thu, Jun 4, 2020 at 7:01 PM brian m. carlson wrote:
> > If you really need Git functionality that doesn't rely on sh, you can
> > look into libgit2 and its assorted language wrappers.
>
> Uh yeah, no. Im not reimplementing the entire Git program, when the fix is 7
> lines. Here it is, if anyone is interested:
>
> diff --git a/run-command.c b/run-command.c
> index 9b3a57d..4945632 100644
> --- a/run-command.c
> +++ b/run-command.c
> @@ -271,9 +271,6 @@ static const char **prepare_shell_cmd(struct
> argv_array *out, const char **argv)
>      if (strcspn(argv[0], "|&;<>()$`\\\"' \t\n*?[#~=%") != strlen(argv[0])) {
>  #ifndef GIT_WINDOWS_NATIVE
>          argv_array_push(out, SHELL_PATH);
> -#else
> -        argv_array_push(out, "sh");
> -#endif
>          argv_array_push(out, "-c");
>
>          /*
> @@ -284,6 +281,10 @@ static const char **prepare_shell_cmd(struct
> argv_array *out, const char **argv)
>              argv_array_push(out, argv[0]);
>          else
>              argv_array_pushf(out, "%s \"$@\"", argv[0]);
> +#else
> +        argv_array_push(out, "powershell");
> +        argv_array_push(out, "-Command");
> +#endif

That assumes that PowerShell is installed, which is not guaranteed, either.

Besides, quoting rules are most likely different with PowerShell than what Git assumes, so you will have to take care of that, too.

Finally, there are plenty of tips out there in the internet that simply expect a POSIX shell to execute those script snippets. Any user would be completely (and unnnecessarily) puzzled if those snippets won't work with their Git for Windows.

In short: it would be unwise for me to accept this change into Git for Windows, at least as-is.

Ciao, Johannes

>      }
>
>      argv_array_pushv(out, argv);
>
Previous: Jonathan NiederNext: Steven Penny
Message 5 of 7 in “Change Native Windows shell”
  1. Steven PennyJun 4, 2020
  2. brian m. carlsonJun 5, 2020
  3. Steven PennyJun 5, 2020
  4. Jonathan NiederJun 5, 2020
  5. Johannes SchindelinJun 8, 2020
  6. Steven PennyJun 8, 2020
  7. Johannes SchindelinJun 9, 2020

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.