Skip to content

Commit cddbda4

Browse files
committed
Merge branch 'js/mingw-hooks-with-exe-suffix'
Names of the various hook scripts must be spelled exactly, but on Windows, an .exe binary must be named with .exe suffix; notice $GIT_DIR/hooks/<hookname>.exe as a valid <hookname> hook. * js/mingw-hooks-with-exe-suffix: mingw: allow hooks to be .exe files
2 parents 140d41a + 235be51 commit cddbda4

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)