Skip to main content

resolve_git_hooks_dir

Function resolve_git_hooks_dir 

Source
pub fn resolve_git_hooks_dir(cwd: &Path) -> Result<PathBuf, ChangedFilesError>
Expand description

Resolve the folder from which Git runs the hooks of cwd.

Git reads core.hooksPath when it is set, and resolves a relative value against the work tree. Otherwise the folder is hooks in the common directory, which a linked worktree shares with the main checkout. The folder does not have to exist. Git prints a relative path against cwd, so the probe works without --path-format, which needs Git 2.31.

ยงErrors

Returns the reason when git is missing, cwd is not in a repository, or git prints anything other than one path.