summaryrefslogtreecommitdiff
path: root/run-command.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-02-02 21:36:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-02 21:36:57 (GMT)
commitcddbda4bc87b9d2c985b6749b1cf026b15e2d3e7 (patch)
tree9f50c38a22c7db88038cc061af38f5ebae7cb575 /run-command.c
parent140d41ae87274303f972702ce394544407d5c21e (diff)
parent235be51fbecbbdaafd48f762e808c55861e02850 (diff)
downloadgit-cddbda4bc87b9d2c985b6749b1cf026b15e2d3e7.zip
git-cddbda4bc87b9d2c985b6749b1cf026b15e2d3e7.tar.gz
git-cddbda4bc87b9d2c985b6749b1cf026b15e2d3e7.tar.bz2
Merge branch 'js/mingw-hooks-with-exe-suffix'
Names of the various hook scripts must be spelled exactly, but on Windows, an .exe binary must be named with .exe suffix; notice $GIT_DIR/hooks/<hookname>.exe as a valid <hookname> hook. * js/mingw-hooks-with-exe-suffix: mingw: allow hooks to be .exe files
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 73bfba7..5227f78 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, STRIP_EXTENSION);
+ if (access(path.buf, X_OK) >= 0)
+ return path.buf;
+#endif
return NULL;
+ }
return path.buf;
}