From 309fcffc867f321f02885f809fecac06edf1ed06 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 11 Sep 2025 05:39:32 -0500 Subject: code to double check remote branches are in sync --- doClean.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'doClean.go') diff --git a/doClean.go b/doClean.go index 8263d2e..fc04bdc 100644 --- a/doClean.go +++ b/doClean.go @@ -7,13 +7,36 @@ import ( "fmt" "path/filepath" + "go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) +func checkRemoteBranches(repo *gitpb.Repo) error { + if repo.VerifyRemoteAndLocalBranches(repo.GetDevelBranchName()) { + repo.Reload() + me.forge.SetConfigSave(true) + return log.Errorf("devel is bad") + } + if repo.VerifyRemoteAndLocalBranches(repo.GetMasterBranchName()) { + repo.Reload() + me.forge.SetConfigSave(true) + return log.Errorf("master is bad") + } + return nil +} + // reverts all repos back to the original master branches // automatically deletes local devel and user branches func doClean() error { + me.forge.Config.Mode = forgepb.ForgeMode_CLEAN + + if argv.Clean.Verify != nil { + stats := me.forge.RillRepos(checkRemoteBranches) + _ = stats + return nil + } + // fix this to work, then delete all the other options for "forge clean' if err := me.forge.DoAllCheckoutMaster(); err != nil { // badExit(err) -- cgit v1.2.3