mingw: allow hooks to be .exe files
[gitweb.git] / run-command.c
index ca905a9e8038dda26f8c4e146049ad00ed1cd8df..79780a4ab251ab8d277141231e5a9b52b7123c11 100644 (file)
@@ -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;
 }