mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-29 13:48:07 -05:00
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:
committed by
Johannes Schindelin
parent
2318a50e43
commit
1208b8a6b0
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user