Skip to content

Commit e3ebd58

Browse files
committed
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 f9b4594 commit e3ebd58

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

run-command.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,12 @@ 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, ".exe");
858+
if (access(path.buf, X_OK) >= 0)
859+
return path.buf;
860+
#endif
856861
return NULL;
857862
return path.buf;
858863
}

0 commit comments

Comments
 (0)