Compare commits

...

2 Commits

Author SHA1 Message Date
Jeff Carr 6bfd8c78ab save config if Username not set 2025-09-22 21:08:29 -05:00
Jeff Carr 060c304a43 forgot to set Username on init() 2025-09-22 21:07:32 -05:00
3 changed files with 12 additions and 6 deletions

View File

@ -72,12 +72,6 @@ func (cfg *ForgeConfigs) DumpENV() {
}
/*
if f.Config.Username == "" {
usr, _ := user.Current()
f.Config.Username = usr.Username
f.SetConfigSave(true)
}
if f.Config.Xterm == "" {
f.Config.Xterm = "xterm"
f.Config.XtermArgv = append(f.Config.XtermArgv, "-bg")

View File

@ -4,6 +4,7 @@ package forgepb
import (
"os"
"os/user"
"path/filepath"
"go.wit.com/lib/config"
@ -40,6 +41,11 @@ func Init() *Forge {
f.Config.DumpENV()
return f
}
if f.Config.Username == "" {
usr, _ := user.Current()
f.Config.Username = usr.Username
f.Config.ConfigSave()
}
f.initFromConfig()
if f.Config.Mode == ForgeMode_MASTER {
log.Printf("forge.Init() %s len()=%d\n", f.Config.Filename, f.Repos.Len())

View File

@ -164,6 +164,9 @@ func (f *Forge) VerifyBranchNames(repo *gitpb.Repo) {
if repo.GetUserBranchName() == "" {
uname := f.configUserBranchName(repo)
if uname == "" {
log.Info("configUserBranchName() ERROR: failed with blank")
}
if repo.IsBranch(uname) {
repo.SetUserBranchName(uname)
} else {
@ -189,6 +192,9 @@ func (f *Forge) configUserBranchName(repo *gitpb.Repo) string {
if uname != "" {
return uname
}
if f.Config.Username == "" {
// something is wrong!
}
// use the os.Username
uname = f.Config.Username