[PATCH 19/40] Windows: Change the name of hook scripts to make them not executable.
- From
Johannes Sixt <johannes.sixt@telecom.at>
- Date
- Feb 27, 2008, 18:54 UTC
- Message-ID
- <1204138503-6126-20-git-send-email-johannes.sixt@telecom.at>
- In-Reply-To
- <1204138503-6126-1-git-send-email-johannes.sixt@telecom.at>
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.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> --- Makefile | 3 ++- templates/Makefile | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile index 069939f..7d4a591 100644 --- a/Makefile +++ b/Makefile @@ -547,6 +547,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) COMPAT_OBJS += compat/mingw.o compat/fnmatch.o compat/regex.o EXTLIBS += -lws2_32 X = .exe + NOEXECTEMPL = .noexec endif ifneq (,$(findstring arm,$(uname_M))) ARM_SHA1 = YesPlease @@ -849,7 +850,7 @@ ifndef NO_TCLTK $(QUIET_SUBDIR0)gitk-git $(QUIET_SUBDIR1) all endif $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all - $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) + $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) NOEXECTEMPL='$(NOEXECTEMPL)' strip: $(PROGRAMS) git$X $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X diff --git a/templates/Makefile b/templates/Makefile index ebd3a62..b341105 100644 --- a/templates/Makefile +++ b/templates/Makefile @@ -10,6 +10,8 @@ RM ?= rm -f 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 accommodate ancient setups); DESTDIR_SQ = $(subst ','\'',$(DESTDIR)) @@ -32,7 +34,11 @@ boilerplates.made : $(bpsrc) mkdir -p blt/$$dir && \ case "$$boilerplate" in \ *--) ;; \ - *) cp $$boilerplate blt/$$dst ;; \ + *) if test -n "$$(sed -ne '/^#!\//p' -e '1q' < "$$boilerplate")"; then \ + cp "$$boilerplate" "blt/$${dst}$(NOEXECTEMPL)"; \ + else \ + cp "$$boilerplate" "blt/$$dst"; \ + fi ;; \ esac || exit; \ done && \ date >$@
-- 1.5.4.1.126.ge5a7d