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

Re: Change Native Windows shell

From
Steven Penny <svnpenn@gmail.com>
Date
Jun 5, 2020, 04:21 UTC
Message-ID
<CAAXzdLVk3jLzuB2vgKGObQDjPydpdiawKJJ+-NMa376Gu1zt1A@mail.gmail.com>
In-Reply-To
<20200605000039.GB6569@camp.crustytoothpaste.net>
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
     }

     argv_array_pushv(out, argv);
Previous: brian m. carlsonNext: Jonathan Nieder
Message 3 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.