fixes to --force and --strict

This commit is contained in:
Jeff Carr 2024-12-14 20:35:00 -06:00
parent f43311c36c
commit f575e95e8f
1 changed files with 14 additions and 15 deletions

View File

@ -101,14 +101,14 @@ func doMain(repo *gitpb.Repo) error {
log.Info("go install go.wit.com/apps/forge@latest") log.Info("go install go.wit.com/apps/forge@latest")
log.Info("") log.Info("")
return errors.New(repo.GoPath + " is invalid. fix your repository list with 'forge' first") return errors.New(repo.GoPath + " is invalid. fix your repository list with 'forge' first")
} else {
log.Info(repo.GoPath, "is valid according to forge")
} }
log.Info(repo.GoPath, "is valid according to forge")
// skip restore if --force // skip restore if --force
if !argv.Force { if argv.Force {
repo.Run([]string{"git", "notes", "remove"})
}
// erase the go.mod and go.sum files // erase the go.mod and go.sum files
eraseGoMod(repo)
cname := repo.GetCurrentBranchName() cname := repo.GetCurrentBranchName()
// try to restore from the git metadata // try to restore from the git metadata
if err := repo.AutogenRestore(cname); err != nil { if err := repo.AutogenRestore(cname); err != nil {
@ -119,7 +119,6 @@ func doMain(repo *gitpb.Repo) error {
configSave = true configSave = true
return nil return nil
} }
}
// double check here. use --force to remake them // double check here. use --force to remake them
if err := repo.ValidGoSum(); err == nil { if err := repo.ValidGoSum(); err == nil {