mingw: allow hooks to be .exe files

This change is necessary to allow the files in .git/hooks/ to optionally
have the file extension `.exe` on Windows, as the file names are
hardcoded otherwise.

Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2016-12-13 17:52:14 +00:00
committed by Johannes Schindelin
parent 2318a50e43
commit 1208b8a6b0

View File

@@ -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;
}