sync: Non-empty directory without .git is Fatal

This commit is contained in:
nemunaire 2022-05-16 11:37:44 +02:00
parent 3c0751a78a
commit 9d639a0315
1 changed files with 2 additions and 0 deletions

View File

@ -66,6 +66,8 @@ func (i GitImporter) Init() error {
return fmt.Errorf("%w:\n%s", err, stdout)
}
log.Println("Local git repository successfully cloned")
} else if _, err := os.Stat(path.Join(i.li.Base, ".git")); errors.Is(err, os.ErrNotExist) {
log.Fatal(i.li.Base, "is not a valid git repository and it cannot be initialized because it's not empty.")
}
// Check if the .git directory exists, change the origin remote to our