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
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 err := sendPatches(pset); err != nil {
badExit(err)
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 {
return err
}
return nil
}
func sendMasterDiff() {

View File

@ -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

View File

@ -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

View File

@ -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})
if err := sendDevelDiff(s.reason.String()); err != nil {
log.Info("sending patches failed", err)
} else {
log.Info("sent patch set ok")
}
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() {
listPatches()