Skip to content

Commit 798fe1c

Browse files
committed
MinGit: use the Git wrapper as ash.exe, if possible
Some programs, such as OpenSSH, require the environment variable `SHELL` to contain an absolute path to an executable. No extra arguments allowed. However, BusyBox' `ash` would need to be called like this: <mingit>\mingw64\bin\busybox.exe sh [...] If the `sh` is omitted, only mayhem will ensue. To allow for setting `SHELL` in such a manner, we taught the good ole' Git wrapper to stand in. That is, if the Git wrapper detects that it is run with the base name `ash.exe` (or `sh.exe`), it will try to spawn BusyBox' `ash` with the same argument, wait for the command to conclude, and then exit with the same exit code. Let's use this version of the Git wrapper, if we have it. This requires git-for-windows/MINGW-packages#52 to work, and allows e.g. using a `ProxyCommand` with OpenSSH, after setting `SHELL` to point to the `ash.exe` file. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 09a0a1e commit 798fe1c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

mingit/release.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,18 @@ then
156156
esac
157157
fi
158158

159+
# Use git-wrapper.exe as ash.exe if supported
160+
if test -f "$SCRIPT_PATH/root/$BIN_DIR"/busybox.exe
161+
then
162+
# verify that the Git wrapper works
163+
cp "/mingw$BITNESS/share/git/git-wrapper.exe" "$SCRIPT_PATH/root/$BIN_DIR"/ash.exe
164+
uname="$($SCRIPT_PATH/root/$BIN_DIR/ash.exe -c uname 2>&1)"
165+
case "$?,$uname" in
166+
0,*BusyBox*) ;; # okay, let's use the Git wrapper
167+
*) rm "$SCRIPT_PATH/root/$BIN_DIR"/ash.exe;;
168+
esac
169+
fi
170+
159171
test ! -f "$TARGET" || rm "$TARGET" || die "Could not remove $TARGET"
160172

161173
echo "Creating .zip archive" &&

0 commit comments

Comments
 (0)