Skip to content

Commit 039c6f1

Browse files
author
H. Peter Anvin
committed
Better handling of exec extension in the git wrapper script
1 parent 9220282 commit 039c6f1

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ all:
273273
git: git.sh Makefile
274274
rm -f $@+ $@
275275
sed -e '1s|#!.*/sh|#!$(SHELL_PATH)|' \
276-
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' <$@.sh >$@+
276+
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
277+
-e 's/@@X@@/$(X)/g' <$@.sh >$@+
277278
chmod +x $@+
278279
mv $@+ $@
279280

git.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@ case "$#" in
1111
echo "git version @@GIT_VERSION@@"
1212
exit 0 ;;
1313
esac
14-
15-
test -x $path/git-$cmd && exec $path/git-$cmd "$@" ;;
16-
17-
# In case we're running on Cygwin...
18-
test -x $path/git-$cmd.exe && exec $path/git-$cmd.exe "$@" ;;
14+
15+
test -x $path/git-$cmd && exec $path/git-$cmd "$@"
16+
17+
case '@@X@@' in
18+
'')
19+
;;
20+
*)
21+
test -x $path/git-$cmd@@X@@ && exec $path/git-$cmd@@X@@ "$@"
22+
;;
23+
esac
24+
;;
1925
esac
2026

2127
echo "Usage: git COMMAND [OPTIONS] [TARGET]"

0 commit comments

Comments
 (0)