Skip to content

Commit 235be51

Browse files
dschogitster
authored andcommitted
mingw: allow hooks to be .exe files
Executable files in Windows need to have the extension '.exe', otherwise they do not work. Extend the hooks to not just look at the hard coded names, but also at the names extended by the custom STRIP_EXTENSION, which is defined as '.exe' in Windows. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ad36dc8 commit 235be51

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)