You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make gitdir work with worktrees, respect core.hooksPath, etc
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.
Other paths inside `.git` are equally subject to differ from
`<gitdir>/<path>`, i.e. inside worktrees, where _some_ paths live in the
"gitdir" and some live in the "commondir" (i.e. the "gitdir" of the main
worktree).
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, however, during
the code submission it was deemed better to fix all call to the `gitdir`
function.
To avoid spawning a gazillion `git rev-parse --git-path` instances, we
cache the returned paths, priming the cache upon startup in a single
`git rev-parse invocation` with some paths (that have been
determined via a typical startup and via grepping the source code for
calls to the `gitdir` function).
This fixesgit-for-windows#1755
Initial-patch-by: Philipp Gortan <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>
0 commit comments