Centralize Git identity environment construction

This commit is contained in:
Ian Gulliver
2026-10-21 11:12:54 -07:00
parent 9d0ffb5723
commit ae4cc5d57b
12 changed files with 23 additions and 69 deletions
+1 -13
View File
@@ -27,8 +27,6 @@ type Options struct {
Resume string
ForkFrom string
ForkAt string
GitName string
GitEmail string
Env []string
Guidance string
Reminder string
@@ -158,7 +156,7 @@ func spawn(opts Options) (*Session, error) {
cmd := procgroup.Command("codex", "app-server", "-c", "check_for_update_on_startup=false")
cmd.Dir = opts.Cwd
cmd.Stderr = os.Stderr
cmd.Env = buildEnv(opts)
cmd.Env = append(os.Environ(), opts.Env...)
stdinR, stdin, err := os.Pipe()
if err != nil {
@@ -321,16 +319,6 @@ func (s *Session) setThread(id string) {
s.stateMu.Unlock()
}
func buildEnv(opts Options) []string {
env := append(os.Environ(),
"GIT_AUTHOR_NAME="+opts.GitName,
"GIT_AUTHOR_EMAIL="+opts.GitEmail,
"GIT_COMMITTER_NAME="+opts.GitName,
"GIT_COMMITTER_EMAIL="+opts.GitEmail,
)
return append(env, opts.Env...)
}
func (s *Session) Events() <-chan Event {
return s.events
}