summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2017-01-30 12:28:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-30 16:49:43 (GMT)
commit235be51fbecbbdaafd48f762e808c55861e02850 (patch)
tree18eaad290ad2197ff4ce0a9e60ed93f4b249f1e3 /run-command.c
parentad36dc8b4b165bf9eb3576b42a241164e312d48c (diff)
downloadgit-235be51fbecbbdaafd48f762e808c55861e02850.zip
git-235be51fbecbbdaafd48f762e808c55861e02850.tar.gz
git-235be51fbecbbdaafd48f762e808c55861e02850.tar.bz2
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 <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r--run-command.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/run-command.c b/run-command.c
index ca905a9..79780a4 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;
}