diff options
| author | Jeff Carr <[email protected]> | 2025-01-20 01:47:27 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-20 01:47:27 -0600 |
| commit | 25b2e50f6b1a15f887416479cd0df583cc6d4e19 (patch) | |
| tree | 53df31b1523a11aa93c5c61cd04c64555578627a /doCommit.go | |
| parent | ca51b9ba74535ddfd01b15a395b910ac12767241 (diff) | |
git commit --all works
Diffstat (limited to 'doCommit.go')
| -rw-r--r-- | doCommit.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/doCommit.go b/doCommit.go new file mode 100644 index 0000000..ae8af1a --- /dev/null +++ b/doCommit.go @@ -0,0 +1,38 @@ +package main + +import ( + "os" + + "go.wit.com/lib/gui/shell" + "go.wit.com/log" +) + +func doCommit() { + pwd, _ := os.Getwd() + repo := me.forge.Repos.FindByFullPath(pwd) + if repo == nil { + log.Info("what branch are you on?: todo: examine this") + okExit("") + } + 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("") + okExit("") + } + os.Setenv("LESS", "-XR") + if err := shell.Exec([]string{"git", "diff"}); err != nil { + badExit(err) + } + if argv.All { + if err := shell.ExecCheck([]string{"git", "add", "--all"}); err != nil { + badExit(err) + } + } + if err := shell.ExecCheck([]string{"git", "commit", "--all"}); err != nil { + badExit(err) + } + log.Info("git commit ok. forge done") +} |
