1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-02-09 13:47:11 +02:00

Improve directory check for .git

Return error if the .git exists but is not a directory. This provides a
slightly better failure message for git repo with submodules in case
the '.git' is a file which provides the reference to the parent's .git
folder with the submodule inside.
This commit is contained in:
Suhas Karanth 2019-05-03 12:32:57 +05:30 committed by Jesse Duffield
parent b505c295d2
commit e09aac6450

View File

@ -27,8 +27,11 @@ func navigateToRepoRootDirectory(stat func(string) (os.FileInfo, error), chdir f
for {
f, err := stat(".git")
if err == nil && f.IsDir() {
return nil
if err == nil {
if f.IsDir() {
return nil
}
return errors.New("expected .git to be a directory")
}
if !os.IsNotExist(err) {