diff --git a/Makefile b/Makefile index 3144430a97..7e4fed4416 100644 --- a/Makefile +++ b/Makefile @@ -434,6 +434,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) COMPAT_OBJS += compat/mingw.o compat/fnmatch.o EXTLIBS += -lws2_32 -lregex X = .exe + NOEXECTEMPL = .noexec endif ifneq (,$(findstring arm,$(uname_M))) ARM_SHA1 = YesPlease @@ -635,7 +636,7 @@ endif all:: $(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all - $(MAKE) -C templates + $(MAKE) -C templates NOEXECTEMPL='$(NOEXECTEMPL)' strip: $(PROGRAMS) git$X $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X diff --git a/templates/Makefile b/templates/Makefile index 9e1ae1a4e0..68614c1cc7 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -5,6 +5,8 @@ TAR ?= tar prefix ?= $(HOME) template_dir ?= $(prefix)/share/git-core/templates/ # DESTDIR= +# set NOEXECTEMPL to non-empty to change the names of hook scripts +# so that the tools will not find them # Shell quote (do not use $(call) to accomodate ancient setups); DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) @@ -27,7 +29,11 @@ boilerplates.made : $(bpsrc) mkdir -p blt/$$dir && \ case "$$boilerplate" in \ *--) ;; \ - *) cp $$boilerplate blt/$$dst ;; \ + *) if head -1 $$boilerplate | grep -q '^#!/'; then \ + cp $$boilerplate blt/$${dst}$(NOEXECTEMPL); \ + else \ + cp $$boilerplate blt/$$dst; \ + fi ;; \ esac || exit; \ done || exit date >$@