mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-03 00:57:52 +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:
committed by
Jesse Duffield
parent
b505c295d2
commit
e09aac6450
@ -27,8 +27,11 @@ func navigateToRepoRootDirectory(stat func(string) (os.FileInfo, error), chdir f
|
|||||||
for {
|
for {
|
||||||
f, err := stat(".git")
|
f, err := stat(".git")
|
||||||
|
|
||||||
if err == nil && f.IsDir() {
|
if err == nil {
|
||||||
return nil
|
if f.IsDir() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return errors.New("expected .git to be a directory")
|
||||||
}
|
}
|
||||||
|
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
|
Reference in New Issue
Block a user