Skip to content

Commit a787168

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
respect core.hooksPath, falling back to .git/hooks
Since v2.9.0, Git knows about the config variable core.hookspath that allows overriding the path to the directory containing the Git hooks. Since v2.10.0, the `--git-path` option respects that config variable, too, so we may just as well use that command. For Git versions older than v2.5.0 (which was the first version to support the `--git-path` option for the `rev-parse` command), we simply fall back to the previous code. This fixes #1755 Initial-patch-by: Philipp Gortan <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 16b966f commit a787168

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

git-gui/git-gui.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,11 @@ proc git_write {args} {
685685
}
686686

687687
proc githook_read {hook_name args} {
688-
set pchook [gitdir hooks $hook_name]
688+
if {[package vcompare $::_git_version 2.5.0] >= 0} {
689+
set pchook [git rev-parse --git-path "hooks/$hook_name"]
690+
} else {
691+
set pchook [gitdir hooks $hook_name]
692+
}
689693
lappend args 2>@1
690694

691695
# On Windows [file executable] might lie so we need to ask

0 commit comments

Comments
 (0)