Centralize Git identity environment construction
This commit is contained in:
@@ -949,6 +949,7 @@ func (m *Manager) startLive(ctx context.Context, sess api.AgentSession, task api
|
||||
tools = append(m.leadTools(l), m.readKnowledgeTool())
|
||||
env = nil
|
||||
}
|
||||
env = append(git.IdentityEnv(l.gitName, l.gitEmail), env...)
|
||||
servers := []*mcp.Server{{Name: "byre", Version: "0.0.0", Tools: tools}}
|
||||
|
||||
sctx, cancel := context.WithTimeout(ctx, 60*time.Second)
|
||||
|
||||
@@ -514,12 +514,7 @@ func (m *Manager) squashAndClose(ctx context.Context, taskID, login string) erro
|
||||
return err
|
||||
}
|
||||
|
||||
env := []string{
|
||||
"GIT_AUTHOR_NAME=" + user.GitName,
|
||||
"GIT_AUTHOR_EMAIL=" + user.GitEmail,
|
||||
"GIT_COMMITTER_NAME=" + user.GitName,
|
||||
"GIT_COMMITTER_EMAIL=" + user.GitEmail,
|
||||
}
|
||||
env := git.IdentityEnv(user.GitName, user.GitEmail)
|
||||
commit, err := git.SquashCommit(project.RepoPath, task.WorktreePath, project.DefaultBranch, squashMessage(task.MergeTitle, coAuthors), env, m.signer(ctx, user))
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -123,12 +123,7 @@ func (m *Manager) pushToMain(ctx context.Context, l *live, task api.Task, projec
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
env := []string{
|
||||
"GIT_AUTHOR_NAME=" + user.GitName,
|
||||
"GIT_AUTHOR_EMAIL=" + user.GitEmail,
|
||||
"GIT_COMMITTER_NAME=" + user.GitName,
|
||||
"GIT_COMMITTER_EMAIL=" + user.GitEmail,
|
||||
}
|
||||
env := git.IdentityEnv(user.GitName, user.GitEmail)
|
||||
commit, err := git.SquashCommit(project.RepoPath, l.dir, project.DefaultBranch, squashMessage(title, coAuthors), env, m.signer(ctx, user))
|
||||
conflict := &git.ConflictError{}
|
||||
if errors.As(err, &conflict) {
|
||||
|
||||
@@ -88,8 +88,6 @@ func (m *Manager) startClaude(ctx context.Context, sess api.AgentSession, l *liv
|
||||
opts := claude.Options{
|
||||
Cwd: l.dir,
|
||||
Model: sess.Model,
|
||||
GitName: l.gitName,
|
||||
GitEmail: l.gitEmail,
|
||||
Env: env,
|
||||
Guidance: g + l.notes,
|
||||
MCPServers: servers,
|
||||
@@ -169,8 +167,6 @@ func (m *Manager) startCodex(ctx context.Context, sess api.AgentSession, l *live
|
||||
opts := codex.Options{
|
||||
Cwd: l.dir,
|
||||
Model: sess.Model,
|
||||
GitName: l.gitName,
|
||||
GitEmail: l.gitEmail,
|
||||
Env: append(env, "CODEX_HOME="+m.codexHome),
|
||||
Guidance: g + l.notes,
|
||||
Reminder: g,
|
||||
@@ -247,8 +243,6 @@ func (m *Manager) startAntigravity(ctx context.Context, sess api.AgentSession, l
|
||||
Cwd: l.dir,
|
||||
Model: sess.Model,
|
||||
Resume: sess.VendorSessionId,
|
||||
GitName: l.gitName,
|
||||
GitEmail: l.gitEmail,
|
||||
Env: env,
|
||||
Guidance: g,
|
||||
Notes: strings.TrimSpace(l.notes),
|
||||
|
||||
@@ -155,12 +155,7 @@ func (m *Manager) takeSnapshot(ctx context.Context, t snapTarget, trigger api.Sn
|
||||
}
|
||||
|
||||
n := last.N + 1
|
||||
commit, err := git.CommitSnapshot(t.dir, tree, git.SnapshotRef(t.taskID, n), fmt.Sprintf("byre snapshot %d (%s)", n, trigger), []string{
|
||||
"GIT_AUTHOR_NAME=" + t.gitName,
|
||||
"GIT_AUTHOR_EMAIL=" + t.gitEmail,
|
||||
"GIT_COMMITTER_NAME=" + t.gitName,
|
||||
"GIT_COMMITTER_EMAIL=" + t.gitEmail,
|
||||
})
|
||||
commit, err := git.CommitSnapshot(t.dir, tree, git.SnapshotRef(t.taskID, n), fmt.Sprintf("byre snapshot %d (%s)", n, trigger), git.IdentityEnv(t.gitName, t.gitEmail))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user