Fix #1279: Error not git repository on yay -Sc

This commit is contained in:
Matheus Alcantara authored and J Guerreiro committed 2020-06-30 09:56:31 +02:00
1 parent acf95aed5b
commit 3549aeca26
1 file changed
+9 -3
+9 -3
View File
@@ -196,14 +196,20 @@ func cleanUntracked() error {
}
dir := filepath.Join(config.BuildDir, file.Name())
if err := show(passToGit(dir, "clean", "-fx")); err != nil {
return err
if isGitRepository(dir) {
if err := show(passToGit(dir, "clean", "-fx")); err != nil {
return err
}
}
}
return nil
}
func isGitRepository(dir string) bool {
_, err := os.Stat(filepath.Join(dir, ".git"))
return !os.IsNotExist(err)
}
func cleanAfter(bases []Base) {
fmt.Println(gotext.Get("removing untracked AUR files from cache..."))