new autogen

This commit is contained in:
Jeff Carr 2025-02-20 09:37:42 -06:00
parent 5db0b57b31
commit 77da32b99a
2 changed files with 46 additions and 1 deletions

View File

@ -7,7 +7,7 @@ BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
# make andlabs # try the andlabs gui plugin (uses GTK)
default: install
forge
forge commit --all
vet:
@GO111MODULE=off go vet

View File

@ -7,10 +7,27 @@ import (
"os"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
func doCommit() {
if argv.All {
log.Info("do a commit everywhere")
doCheckDirtyAndConfigSave()
me.found = new(gitpb.Repos)
findDirty()
all := me.found.All()
for all.Scan() {
repo := all.Next()
log.Info("do a commit on repo", repo.GetGoPath())
if err := doCommitRepo(repo); err != nil {
badExit(err)
}
}
okExit("")
}
pwd, _ := os.Getwd()
repo := me.forge.Repos.FindByFullPath(pwd)
if repo == nil {
@ -43,3 +60,31 @@ func doCommit() {
}
log.Info("git commit ok. forge done")
}
func doCommitRepo(repo *gitpb.Repo) error {
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
me.found.Append(repo)
me.forge.PrintHumanTable(me.found)
log.Info("")
log.Info("wrong branch. Can not commit on", repo.GetCurrentBranchName())
log.Info("")
return nil
}
os.Setenv("LESS", "-XR")
if err := shell.Exec([]string{"git", "diff"}); err != nil {
return err
}
if argv.All {
if err := shell.ExecCheck([]string{"git", "add", "--all"}); err != nil {
return err
}
}
if err := shell.ExecCheck([]string{"git", "commit", "--all"}); err != nil {
return err
}
log.Info("git commit ok. forge done")
return nil
}