MCPcopy
hub / github.com/git-lfs/git-lfs / HookDir

Method HookDir

config/config.go:349–364  ·  view source on GitHub ↗

HookDir returns the location of the hooks owned by this repository. If the core.hooksPath configuration variable is supported, we prefer that and expand paths appropriately.

()

Source from the content-addressed store, hash-verified

347// core.hooksPath configuration variable is supported, we prefer that and expand
348// paths appropriately.
349func (c *Configuration) HookDir() (string, error) {
350 if git.IsGitVersionAtLeast("2.9.0") {
351 hp, ok := c.Git.Get("core.hooksPath")
352 if ok {
353 path, err := tools.ExpandPath(hp, false)
354 if err != nil {
355 return "", err
356 }
357 if filepath.IsAbs(path) {
358 return path, nil
359 }
360 return filepath.Join(c.LocalWorkingDir(), path), nil
361 }
362 }
363 return filepath.Join(c.LocalGitStorageDir(), "hooks"), nil
364}
365
366func (c *Configuration) InRepo() bool {
367 return len(c.LocalGitDir()) > 0

Callers 3

getHookInstallStepsFunction · 0.80
installHooksFunction · 0.80
uninstallHooksFunction · 0.80

Calls 5

LocalWorkingDirMethod · 0.95
LocalGitStorageDirMethod · 0.95
IsGitVersionAtLeastFunction · 0.92
ExpandPathFunction · 0.92
GetMethod · 0.65

Tested by

no test coverage detected