From 71a0b8f19f52dc43e5f4bdfde78eae85fbc7f74e Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 9 Oct 2025 20:28:54 -0500 Subject: more standard function handling --- doCommit.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'doCommit.go') diff --git a/doCommit.go b/doCommit.go index 5539c54..9a24263 100644 --- a/doCommit.go +++ b/doCommit.go @@ -4,12 +4,14 @@ package main import ( + "errors" + "go.wit.com/lib/config" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) -func doCommit() error { +func doCommit() (string, error) { if argv.Commit.All || argv.All { found := me.forge.CheckDirty() var newpatches bool @@ -25,7 +27,7 @@ func doCommit() error { config.SetChanged("repos", true) return doPatchSubmit() } - okExit("") + return "git ommit --all done", nil } repo := findCurrentPwdRepoOrDie() @@ -39,15 +41,16 @@ func doCommit() error { if repo.GetCurrentBranchName() != repo.GetUserBranchName() { found := new(gitpb.Repos) found.Append(repo) - me.forge.PrintHumanTable(found) + footer := me.forge.PrintHumanTable(found) + log.Info(footer) log.Info("") log.Info("wrong branch. Can not commit on", repo.GetCurrentBranchName()) log.Info("") - okExit("") + return "repo must be on user branch", errors.New("repo must be on user branch") } if err := repo.GitCommit(); err != nil { - badExit(err) + return "git commit --all", err } return doPatchSubmit() -- cgit v1.2.3