Find a file
Shawn O. Pearce c136f2b8b9 git-gui: Perform our own magic shbang detection on Windows
If we cannot locate a .exe for a git tool that we want to run than
it may just be a Bourne shell script as these are popular in Git.
In such a case the first line of the file will say "#!/bin/sh" so
a UNIX kernel knows what program to start to parse and run that.
But Windows doesn't support shbang lines, and neither does the Tcl
that comes with Cygwin.

We can pass control off to the git wrapper as that is a real Cygwin
program and can therefore start the Bourne shell script, but that is
at least two fork+exec calls to get the program running.  One to do
the fork+exec of the git wrapper and another to start the Bourne shell
script.  If the program is run multiple times it is rather expensive
as the magic shbang detection won't be cached across executions.

On MinGW/MSYS we don't have the luxury of such magic detection.  The
MSYS team has taught some of this magic to the git wrapper, but again
its slower than it needs to be as the git wrapper must still go and
run the Bourne shell after it is called.

We now attempt to guess the shbang line on Windows by reading the
first line of the file and building our own command line path from
it.  Currently we support Bourne shell (sh), Perl and Python.  That
is the entire set of shbang lines that appear in git.git today.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-07-09 02:47:33 -04:00
lib git-gui: Always use absolute path to all git executables 2007-07-09 01:17:09 -04:00
.gitignore git-gui: Refactor into multiple files to save my sanity 2007-05-07 23:35:48 -04:00
git-gui.sh git-gui: Perform our own magic shbang detection on Windows 2007-07-09 02:47:33 -04:00
GIT-VERSION-GEN Merge branch 'maint' 2007-06-11 19:06:15 -04:00
Makefile Merge branch 'maint' 2007-06-27 00:36:38 -04:00