Skip to content

Commit

Permalink
mingw: allow hooks to be .exe files
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dscho committed Feb 2, 2017
1 parent 47fcc46 commit f80c290
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion run-command.c
Original file line number Diff line number Diff line change
Expand Up @@ -871,8 +871,14 @@ const char *find_hook(const char *name)

strbuf_reset(&path);
strbuf_git_path(&path, "hooks/%s", name);
if (access(path.buf, X_OK) < 0)
if (access(path.buf, X_OK) < 0) {
#ifdef STRIP_EXTENSION
strbuf_addstr(&path, STRIP_EXTENSION);
if (access(path.buf, X_OK) >= 0)
return path.buf;
#endif
return NULL;
}
return path.buf;
}

Expand Down

0 comments on commit f80c290

Please sign in to comment.