git commit --all works
This commit is contained in:
parent
ca51b9ba74
commit
25b2e50f6b
|
@ -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")
|
||||||
|
}
|
24
main.go
24
main.go
|
@ -8,7 +8,6 @@ import (
|
||||||
|
|
||||||
"go.wit.com/dev/alexflint/arg"
|
"go.wit.com/dev/alexflint/arg"
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/lib/gui/shell"
|
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -62,28 +61,7 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.Commit != nil {
|
if argv.Commit != nil {
|
||||||
pwd, _ := os.Getwd()
|
doCommit()
|
||||||
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")
|
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue