From daabe66f1811adc90825a75ff1b4116e4e7f4a4c Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Thu, 25 Jan 2007 09:17:06 +0100 Subject: [PATCH] MinGW: Change the name of hook scripts to make them not executable by default. Since on Windows there is no 'executable' bit whose absence would deny execution of a script, we must change the hook scripts' names entirely to inhibit that they can be invoked by the tools. --- Makefile | 3 ++- templates/Makefile | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) 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 >$@ -- 2.11.4.GIT