mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-05 10:26:35 +00:00
catch case when hook path is default
This commit is contained in:
@@ -526,7 +526,11 @@ func GetGitRoot() (string, error) {
|
|||||||
func getHooksPath() (string, error) {
|
func getHooksPath() (string, error) {
|
||||||
out, err := exec.Command("git", "config", "core.hooksPath").Output()
|
out, err := exec.Command("git", "config", "core.hooksPath").Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to get Git hooks path: %s", err)
|
if len(out) == 0 {
|
||||||
|
out = []byte(".git/hooks") // set the default hook
|
||||||
|
} else {
|
||||||
|
log.Error().Msgf("Failed to get Git hooks path: %s\nOutput: %s\n", err, out)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hooksPath := strings.TrimSpace(string(out))
|
hooksPath := strings.TrimSpace(string(out))
|
||||||
|
|||||||
Reference in New Issue
Block a user