summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-29 21:36:39 -0600
committerJeff Carr <[email protected]>2024-12-29 21:36:39 -0600
commit45c32bc7fc00fd43b1b54d36f96671368323d238 (patch)
treee33efb99a3dc5b775b59733ea9198b6ca1d9f8d9
parent16a6c8b11ae51c693011e7d107adb15e99d4fe54 (diff)
add git author and emailv0.22.32
-rw-r--r--send.go19
-rw-r--r--structs.go3
-rw-r--r--windowMain.go12
-rw-r--r--windowPatches.go20
4 files changed, 36 insertions, 18 deletions
diff --git a/send.go b/send.go
index f1f5dd4..a534d1a 100644
--- a/send.go
+++ b/send.go
@@ -3,6 +3,7 @@
package main
import (
+ "fmt"
"os"
"path/filepath"
"strings"
@@ -95,15 +96,27 @@ func getPatch(pbfile string) error {
return nil
}
-func sendDevelDiff(name string) {
+func sendDevelDiff(name string) error {
pset, err := me.forge.MakeDevelPatchSet()
if err != nil {
- badExit(err)
+ return err
}
pset.Name = name
+ if os.Getenv("GIT_AUTHOR_NAME") == "" {
+ return fmt.Errorf("GIT_AUTHOR_NAME not set")
+ } else {
+ pset.GitAuthorName = os.Getenv("GIT_AUTHOR_NAME")
+ }
+ if os.Getenv("GIT_AUTHOR_EMAIL") == "" {
+ return fmt.Errorf("GIT_AUTHOR_EMAIL not set")
+ } else {
+ pset.GitAuthorEmail = os.Getenv("GIT_AUTHOR_EMAIL")
+ }
+
if err := sendPatches(pset); err != nil {
- badExit(err)
+ return err
}
+ return nil
}
func sendMasterDiff() {
diff --git a/structs.go b/structs.go
index b5f5ee0..f079bc5 100644
--- a/structs.go
+++ b/structs.go
@@ -56,6 +56,9 @@ type mainType struct {
// what is being used as ~/go/src
goSrcPwd *gadgets.OneLiner
+ // ENV GIT_AUTHOR NAME and EMAIL
+ gitAuthor *gadgets.OneLiner
+
// displays a summary of all the repos
// has total dirty, total read-only
// total patches, etc
diff --git a/windowMain.go b/windowMain.go
index 5f7a71b..eb55656 100644
--- a/windowMain.go
+++ b/windowMain.go
@@ -65,6 +65,18 @@ func globalBuildOptions(vbox *gui.Node) {
srcDir := filepath.Join(homeDir, "go/src")
me.goSrcPwd.SetText(srcDir)
+ // use ENV GIT_AUTHOR
+ me.gitAuthor = gadgets.NewOneLiner(grid, "Git Author")
+ grid.NextRow()
+
+ if os.Getenv("GIT_AUTHOR_NAME") == "" {
+ me.gitAuthor.SetText("ENV GIT_AUTHOR_NAME is unset")
+ } else {
+ author := os.Getenv("GIT_AUTHOR_NAME")
+ author += " <" + os.Getenv("GIT_AUTHOR_EMAIL") + ">"
+ me.gitAuthor.SetText(author)
+ }
+
// select the branch you want to test, build and develop against
// this lets you select your user branch, but, when you are happy
// you can merge everything into the devel branch and make sure it actually
diff --git a/windowPatches.go b/windowPatches.go
index 4685561..f0e5d6d 100644
--- a/windowPatches.go
+++ b/windowPatches.go
@@ -157,21 +157,11 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
}
}
s.submitB = s.grid.NewButton("Submit", func() {
- sendDevelDiff(s.reason.String())
- /*
- dirname := "submit-patchset.quilt"
- patchdir := filepath.Join(me.userHomePwd.String(), dirname)
- if shell.Exists(patchdir) {
- log.Info("patchset dir already exists", patchdir)
- shell.PathRun(me.userHomePwd.String(), []string{"rm", "-rf", dirname})
- }
- os.MkdirAll(patchdir, os.ModeDir)
- if !shell.Exists(patchdir) {
- log.Info("something went wrong making", patchdir)
- return
- }
- me.repos.View.MakePatchset(patchdir)
- */
+ if err := sendDevelDiff(s.reason.String()); err != nil {
+ log.Info("sending patches failed", err)
+ } else {
+ log.Info("sent patch set ok")
+ }
})
s.grid.NewButton("Show Patchsets", func() {
listPatches()