Skip to content

Commit

Permalink
Support git workspaces and submodules (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
skryukov authored May 11, 2021
1 parent 9e22b86 commit 45e9234
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ lefthook install`,
return
}

var fs = afero.NewOsFs()
if gitInitialized, _ := afero.DirExists(fs, filepath.Join(getRootPath(), ".git")); gitInitialized {
if gitInitialized, _ := afero.Exists(appFs, filepath.Join(getRootPath(), ".git")); gitInitialized {
return
}

Expand Down Expand Up @@ -142,7 +141,12 @@ func getGitHooksPath() string {
}

func setGitHooksPath(path string) {
gitHooksPath = filepath.Join(getRootPath(), path)
if exists, _ := afero.DirExists(appFs, filepath.Join(getRootPath(), path)); exists {
gitHooksPath = filepath.Join(getRootPath(), path)
return
}

gitHooksPath = path
}

func getHooksPathFromGitConfig() string {
Expand Down

0 comments on commit 45e9234

Please sign in to comment.