All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mingw: allow hooks to be .exe files
@ 2017-01-25 16:58 Johannes Schindelin
  2017-01-25 21:15 ` Jeff King
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Johannes Schindelin @ 2017-01-25 16:58 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

This change is necessary to allow the files in .git/hooks/ to optionally
have the file extension `.exe` on Windows, as the file names are
hardcoded otherwise.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Published-As: https://github.com/dscho/git/releases/tag/exe-as-hook-v1
Fetch-It-Via: git fetch https://github.com/dscho/git exe-as-hook-v1

 run-command.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/run-command.c b/run-command.c
index 73bfba7ef9..45229ef052 100644
--- a/run-command.c
+++ b/run-command.c
@@ -871,8 +871,14 @@ const char *find_hook(const char *name)
 
 	strbuf_reset(&path);
 	strbuf_git_path(&path, "hooks/%s", name);
-	if (access(path.buf, X_OK) < 0)
+	if (access(path.buf, X_OK) < 0) {
+#ifdef STRIP_EXTENSION
+		strbuf_addstr(&path, ".exe");
+		if (access(path.buf, X_OK) >= 0)
+			return path.buf;
+#endif
 		return NULL;
+	}
 	return path.buf;
 }
 

base-commit: 4e59582ff70d299f5a88449891e78d15b4b3fabe
-- 
2.11.1.windows.prerelease.2.3.g7f3eb74

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-01-30 16:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-25 16:58 [PATCH] mingw: allow hooks to be .exe files Johannes Schindelin
2017-01-25 21:15 ` Jeff King
2017-01-25 21:39   ` Junio C Hamano
2017-01-26 12:21   ` Johannes Schindelin
2017-01-26 18:44     ` Junio C Hamano
2017-01-27 10:29       ` Johannes Schindelin
2017-01-27 18:24         ` Stefan Beller
2017-01-30 12:29           ` Johannes Schindelin
2017-01-25 21:39 ` Junio C Hamano
2017-01-26 13:45   ` Johannes Schindelin
2017-01-26 12:21 ` [PATCH v2] " Johannes Schindelin
2017-01-30 12:28   ` [PATCH v3] " Johannes Schindelin
2017-01-30 16:51     ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.