Skip to content

Commit 7c7381f

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 13a05f5 commit 7c7381f

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
@@ -871,8 +871,14 @@ const char *find_hook(const char *name)
871871

872872
strbuf_reset(&path);
873873
strbuf_git_path(&path, "hooks/%s", name);
874-
if (access(path.buf, X_OK) < 0)
874+
if (access(path.buf, X_OK) < 0) {
875+
#ifdef STRIP_EXTENSION
876+
strbuf_addstr(&path, STRIP_EXTENSION);
877+
if (access(path.buf, X_OK) >= 0)
878+
return path.buf;
879+
#endif
875880
return NULL;
881+
}
876882
return path.buf;
877883
}
878884

0 commit comments

Comments
 (0)