Skip to content

Commit 0af09ac

Browse files
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 git-for-windows/git#1755 Initial-patch-by: Philipp Gortan <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 5ab7227 commit 0af09ac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

git-gui.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,11 @@ proc git_write {args} {
624624
}
625625
626626
proc githook_read {hook_name args} {
627-
set pchook [gitdir hooks $hook_name]
627+
if {[package vcompare $::_git_version 2.5.0] >= 0} {
628+
set pchook [git rev-parse --git-path "hooks/$hook_name"]
629+
} else {
630+
set pchook [gitdir hooks $hook_name]
631+
}
628632
lappend args 2>@1
629633
630634
# On Windows [file executable] might lie so we need to ask

0 commit comments

Comments
 (0)