Fix contrib/subtree Makefile to patch #! line
authorCharles Bailey <cbailey32@bloomberg.net>
Sat, 19 Jul 2014 16:08:57 +0000 (17:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Jul 2014 17:39:48 +0000 (10:39 -0700)
Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/subtree/Makefile
index d888d4516114c719e46ab7f2aeb24e63618b7fac..d9a0ce2c6337b906617306f466139b5f486a753d 100644 (file)
@@ -18,6 +18,11 @@ RM       ?= rm -f
 ASCIIDOC = asciidoc
 XMLTO    = xmlto
 
+ifndef SHELL_PATH
+       SHELL_PATH = /bin/sh
+endif
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
+
 ASCIIDOC_CONF = ../../Documentation/asciidoc.conf
 MANPAGE_XSL   = ../../Documentation/manpage-normal.xsl
 
@@ -32,7 +37,8 @@ GIT_SUBTREE_HTML := git-subtree.html
 all: $(GIT_SUBTREE)
 
 $(GIT_SUBTREE): $(GIT_SUBTREE_SH)
-       cp $< $@ && chmod +x $@
+       sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' $< >$@
+       chmod +x $@
 
 doc: $(GIT_SUBTREE_DOC) $(GIT_SUBTREE_HTML)