Centralize Git identity environment construction
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user