Skip to content

Commit b4ed1d0

Browse files
dschoGit for Windows Build Agent
authored andcommitted
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 <[email protected]>
1 parent d9fd0bc commit b4ed1d0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

run-command.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,14 @@ const char *find_hook(const char *name)
852852

853853
strbuf_reset(&path);
854854
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
856861
return NULL;
862+
}
857863
return path.buf;
858864
}
859865

0 commit comments

Comments
 (0)