summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--doGit.go18
-rw-r--r--main.go7
3 files changed, 19 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 86a82ec..496c778 100644
--- a/Makefile
+++ b/Makefile
@@ -71,6 +71,9 @@ apt-update:
-o Dir::Etc::sourceparts=/dev/null \
-o APT::Get::List-Cleanup=0
+commit:
+ forge commit --all
+
merge:
forge merge --all
diff --git a/doGit.go b/doGit.go
index 333ed57..ae1cb6f 100644
--- a/doGit.go
+++ b/doGit.go
@@ -15,7 +15,7 @@ import (
"go.wit.com/log"
)
-func doGit() error {
+func doGit() (string, error) {
log.DaemonMode(true)
defer log.DaemonMode(false)
@@ -23,7 +23,7 @@ func doGit() error {
fstr := "--format=\"%h %>(24)%ar %>(20)%an %s"
cmd := []string{"git", "log", fstr}
shell.RunVerbose(cmd)
- me.sh.GoodExit("")
+ return "git log", nil
}
if argv.Git.Tag != nil {
@@ -35,6 +35,7 @@ func doGit() error {
parts := strings.Split(line, "\x00")
log.Infof("LINE: %d len(%d) %v\n", i, len(parts), parts)
}
+ return "git tags", nil
}
if argv.Git.Who != nil {
@@ -48,19 +49,19 @@ func doGit() error {
}
cmd := []string{"git", "who"}
shell.RunVerbose(cmd)
- me.sh.GoodExit("")
+ return "git who", nil
}
if argv.Git.Pull != nil {
doPull(".config/wit")
doPull("tools")
- me.sh.GoodExit("")
+ return "git pull", nil
}
if argv.Git.Push != nil {
doPush(".config/wit")
doPush("tools")
- me.sh.GoodExit("")
+ return "git push", nil
}
if argv.Git.DeleteUntracked {
@@ -77,13 +78,16 @@ func doGit() error {
cmd := []string{"rm"}
cmd = append(cmd, files...)
_, err := fhelp.RunRealtimeError(cmd)
- return err
+ if err != nil {
+ log.Info("cmd failed", cmd, repo.FullPath, err)
+ return "rm failed", err
+ }
}
}
}
}
- return nil
+ return "todo: put something here", nil
}
func findRepo(wpath string) (*gitpb.Repo, bool) {
diff --git a/main.go b/main.go
index f8a30c9..8ec2446 100644
--- a/main.go
+++ b/main.go
@@ -43,8 +43,11 @@ func main() {
}
if argv.Git != nil {
- doGit()
- me.sh.GoodExit("")
+ s, err := doGit()
+ if err != nil {
+ me.sh.BadExit(s, err)
+ }
+ me.sh.GoodExit(s)
}
if argv.Clone != nil {