add git author and email

This commit is contained in:
Jeff Carr 2024-12-29 21:36:39 -06:00
parent 16a6c8b11a
commit 45c32bc7fc
4 changed files with 37 additions and 19 deletions

21
send.go
View File

@ -3,6 +3,7 @@
package main package main
import ( import (
"fmt"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -95,15 +96,27 @@ func getPatch(pbfile string) error {
return nil return nil
} }
func sendDevelDiff(name string) { func sendDevelDiff(name string) error {
pset, err := me.forge.MakeDevelPatchSet() pset, err := me.forge.MakeDevelPatchSet()
if err != nil { if err != nil {
badExit(err) return err
} }
pset.Name = name pset.Name = name
if err := sendPatches(pset); err != nil { if os.Getenv("GIT_AUTHOR_NAME") == "" {
badExit(err) 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 {
return err
}
return nil
} }
func sendMasterDiff() { func sendMasterDiff() {

View File

@ -56,6 +56,9 @@ type mainType struct {
// what is being used as ~/go/src // what is being used as ~/go/src
goSrcPwd *gadgets.OneLiner goSrcPwd *gadgets.OneLiner
// ENV GIT_AUTHOR NAME and EMAIL
gitAuthor *gadgets.OneLiner
// displays a summary of all the repos // displays a summary of all the repos
// has total dirty, total read-only // has total dirty, total read-only
// total patches, etc // total patches, etc

View File

@ -65,6 +65,18 @@ func globalBuildOptions(vbox *gui.Node) {
srcDir := filepath.Join(homeDir, "go/src") srcDir := filepath.Join(homeDir, "go/src")
me.goSrcPwd.SetText(srcDir) 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 // select the branch you want to test, build and develop against
// this lets you select your user branch, but, when you are happy // 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 // you can merge everything into the devel branch and make sure it actually

View File

@ -157,21 +157,11 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
} }
} }
s.submitB = s.grid.NewButton("Submit", func() { s.submitB = s.grid.NewButton("Submit", func() {
sendDevelDiff(s.reason.String()) if err := sendDevelDiff(s.reason.String()); err != nil {
/* log.Info("sending patches failed", err)
dirname := "submit-patchset.quilt" } else {
patchdir := filepath.Join(me.userHomePwd.String(), dirname) log.Info("sent patch set ok")
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)
*/
}) })
s.grid.NewButton("Show Patchsets", func() { s.grid.NewButton("Show Patchsets", func() {
listPatches() listPatches()