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

This commit is contained in:
Matheus Alcantara 2020-06-26 19:57:10 -03:00 committed by J Guerreiro
parent acf95aed5b
commit 3549aeca26

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..."))