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

Re: [StGIT] Not working on Windows with msysgit.

From
Karl Hasselström <kha@treskal.com>
Date
Aug 4, 2008, 09:25 UTC
Message-ID
<20080804092551.GC9425@diana.vm.bytemark.co.uk>
In-Reply-To
<g6kvmc$sqr$1@ger.gmane.org>
On 2008-07-28 19:29:49 +0200, Jurko Gospodneti? wrote:
> I believe StGIT fails to work on Windows with msysgit installed
> because of the way it runs its external executables. It assumes that
> the executable is available on the path and is named exactly 'git'.
Yes, that's correct.
Show 14 quoted lines
> This however is not the case on Windows with msysgit installed.
> There the 'git executable' is a batch script named git.cmd and stgit
> fails to find it causing all git calls to return an error code.
>
> Popen() calls in StGIT's run.py module seem to run their executables
> (git & gitk only as far as I saw from the sources) directly instead
> of running them through the shell in order to have the shell try all
> the default extensions (configured on Windows using the PATHEXT
> environment variable).
>
> One 'fix' that corrects this in all the use cases on Windows that I
> tried is to add the shell=True parameter to all Popen() calls in
> StGIT's run.py module (one in __run_io() and one in __run_noio()).
> This would however require more testing
Don't do that, please.

The reason to not go via the shell is that that way, we don't have to worry about quoting. That's a big pile of bugs that we never have to see again.

Plus, it's also slightly faster (especially on Windows, I guess) not to have to spawn a shell.

It'd be _much_ better to just be a little more flexible about which git command to use. Maybe look at PATHEXT if we're on Windows, or maybe let the user configure the location of git at stg install time. (RFC) patches welcome: :-)

> I do recall Python having some serious problems with these quoting
> in executed commands... something about external quotes getting
> stripped in some cases... I might be able to dig up a workaround
> from somewhere if needed...
That's the shell doing a level of unquoting. Nothing Python specific.
-- 
Karl Hasselström, kha@treskal.com
      www.treskal.com/kalle
Previous: Jurko Gospodnetić
Message 2 of 2 in “[StGIT] Not working on Windows with msysgit.”
  1. Jurko GospodnetićJul 28, 2008
  2. Karl HasselströmAug 4, 2008

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.