Skip to content

Commit c101422

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. An original patch handled only the hooksPath setting (as the title of this commit message suggests), however, during the code submission it was deemed better to fix all call to the `gitdir` function. With this change, we spawn `git rev-parse --git-path [...]` 13 times during Git GUI's startup. This fixes git-for-windows#1755 Initial-patch-by: Philipp Gortan <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 60c60b6 commit c101422

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
@@ -202,7 +202,11 @@ proc gitdir {args} {
202202
if {$args eq {}} {
203203
return $_gitdir
204204
}
205-
return [eval [list file join $_gitdir] $args]
205+
if {[package vcompare $::_git_version 2.5.0] >= 0} {
206+
return [git rev-parse --git-path [eval [list file join] $args]]
207+
} else {
208+
return [eval [list file join $_gitdir] $args]
209+
}
206210
}
207211

208212
proc gitexec {args} {

0 commit comments

Comments
 (0)