Re: Change Native Windows shell

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Steven,

On Thu, 4 Jun 2020, Steven Penny wrote:

> 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);
>




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux