summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doCommit.go38
-rw-r--r--doPatches.go (renamed from doSubmitPatch.go)0
-rw-r--r--main.go24
-rw-r--r--windowPatchesBox.go (renamed from windowPatches.go)0
4 files changed, 39 insertions, 23 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")
+}
diff --git a/doSubmitPatch.go b/doPatches.go
index 8f7b6dd..8f7b6dd 100644
--- a/doSubmitPatch.go
+++ b/doPatches.go
diff --git a/main.go b/main.go
index eb25299..49dcb8d 100644
--- a/main.go
+++ b/main.go
@@ -8,7 +8,6 @@ import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
- "go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
@@ -62,28 +61,7 @@ func main() {
}
if argv.Commit != nil {
- 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 err := shell.ExecCheck([]string{"git", "commit", "--all"}); err != nil {
- badExit(err)
- }
- log.Info("git commit ok. forge done")
+ doCommit()
okExit("")
}
diff --git a/windowPatches.go b/windowPatchesBox.go
index eeae1e8..eeae1e8 100644
--- a/windowPatches.go
+++ b/windowPatchesBox.go