Worktrees don't inherit git config from main repo, causing 'git commit' to fail with exit status 128 when user.name/user.email are not set. Configure with poimen agent identity before each commit.
This commit is contained in:
@@ -78,6 +78,11 @@ type GitCommitInput struct {
|
|||||||
|
|
||||||
// GitCommitActivity commits changes in a worktree.
|
// GitCommitActivity commits changes in a worktree.
|
||||||
func GitCommitActivity(ctx context.Context, in GitCommitInput) error {
|
func GitCommitActivity(ctx context.Context, in GitCommitInput) error {
|
||||||
|
// Configure git user for commits if not already configured
|
||||||
|
// (worktrees don't inherit config from main repo)
|
||||||
|
exec.CommandContext(ctx, "git", "-C", in.WorktreePath, "config", "user.email", "[email protected]").Run()
|
||||||
|
exec.CommandContext(ctx, "git", "-C", in.WorktreePath, "config", "user.name", "Poimen Agent").Run()
|
||||||
|
|
||||||
// Stage all changes
|
// Stage all changes
|
||||||
cmd := exec.CommandContext(ctx, "git", "-C", in.WorktreePath, "add", "-A")
|
cmd := exec.CommandContext(ctx, "git", "-C", in.WorktreePath, "add", "-A")
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user