properly honor the --force flag of upgrade (#327)

This commit is contained in:
Thibault "bui" Koechlin 2020-10-23 13:48:04 +02:00 committed by GitHub
parent f8917cc014
commit 2fdf7624da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,7 @@ func UpgradeConfig(ttype string, name string) {
continue
}
found = true
if v.UpToDate {
if v.UpToDate && !force_upgrade {
log.Infof("%s : up-to-date", v.Name)
continue
}
@ -40,10 +40,12 @@ func UpgradeConfig(ttype string, name string) {
log.Fatalf("%s : download failed : %v", v.Name, err)
}
if !v.UpToDate {
if v.Tainted {
if v.Tainted && !force_upgrade {
log.Infof("%v %s is tainted, --force to overwrite", emoji.Warning, v.Name)
continue
} else if v.Local {
log.Infof("%v %s is local", emoji.Prohibited, v.Name)
continue
}
} else {
log.Infof("%v %s : updated", emoji.Package, v.Name)