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

Change Native Windows shell

From
Steven Penny <svnpenn@gmail.com>
Date
Jun 4, 2020, 23:33 UTC
Message-ID
<CAAXzdLXt4+-34+OhS=Jn=-VeORN3Y2jMzzg9+bhyn88aN4hm0A@mail.gmail.com>

The Git pager is set up by the function `setup_pager` [1]. `setup_pager` calls `prepare_pager_args` [2]. `prepare_pager_args` sets `use_shell` [3]. Then `setup_pager` calls `start_command` [4]. Then, since `use_shell` has been defined, `prepare_shell_cmd` is called [5]. Finally, regardless of operating system, `sh` is called [6]:

    #ifndef GIT_WINDOWS_NATIVE
                    argv_array_push(out, SHELL_PATH);
    #else
                    argv_array_push(out, "sh");
    #endif
                    argv_array_push(out, "-c");

The issue is, that it is possible to build a fully static native Windows Git [7]. A Git like this can run on a stock Windows system, with no requirement on MSYS2 or Cygwin. So it doesnt make sense for Git to be calling `sh`, when a user may not have or need `sh` on their system. I think that on Native Windows builds, that the Pager should be called directly, or if a shell must be used, then make it `cmd.exe` or `powershell.exe`.

1. https://github.com/git/git/blob/20514004/pager.c#L106
2. https://github.com/git/git/blob/20514004/pager.c#L127
3. https://github.com/git/git/blob/20514004/pager.c#L101
4. https://github.com/git/git/blob/20514004/pager.c#L130
5. https://github.com/git/git/blob/20514004/run-command.c#L928
6. https://github.com/git/git/blob/20514004/run-command.c#L272-L277
7. https://github.com/nu8/gulf/blob/e9ea5c0b/chapter-2/program.sh
Next: brian m. carlson
Message 1 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.