From 235be51fbecbbdaafd48f762e808c55861e02850 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 30 Jan 2017 13:28:28 +0100 Subject: mingw: allow hooks to be .exe files Executable files in Windows need to have the extension '.exe', otherwise they do not work. Extend the hooks to not just look at the hard coded names, but also at the names extended by the custom STRIP_EXTENSION, which is defined as '.exe' in Windows. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- run-command.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'run-command.c') diff --git a/run-command.c b/run-command.c index ca905a9e8..79780a4ab 100644 --- a/run-command.c +++ b/run-command.c @@ -852,8 +852,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, STRIP_EXTENSION); + if (access(path.buf, X_OK) >= 0) + return path.buf; +#endif return NULL; + } return path.buf; } -- cgit v1.2.1