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>

Johannes Schindelin committed Jan 30, 2017 at 13:28 UTC 235be51fbecbbdaafd48f762e808c55861e02850
1 file changed +7 -1
run-command.c
+7 -1
@@ -852,8 +852,14 @@ const char *find_hook(const char *name)
852
853 strbuf_reset(&path);
854 strbuf_git_path(&path, "hooks/%s", name);
855 - if (access(path.buf, X_OK) < 0)
855 + if (access(path.buf, X_OK) < 0) {
856 +#ifdef STRIP_EXTENSION
857 + strbuf_addstr(&path, STRIP_EXTENSION);
858 + if (access(path.buf, X_OK) >= 0)
859 + return path.buf;
860 +#endif
861 return NULL;
862 + }
863 return path.buf;
864 }
865