Refactor agent git state into its own struct to tease apart its locking a bit.
I want to invoke calling the git state when editing files, and that
requires separating it somewhat from the agent's messy and coarse
locking.
diff --git a/loop/agent_git_test.go b/loop/agent_git_test.go
index a1ca128..ae291e0 100644
--- a/loop/agent_git_test.go
+++ b/loop/agent_git_test.go
@@ -59,13 +59,15 @@
agent := &Agent{
workingDir: tempDir,
repoRoot: tempDir, // Set repoRoot to same as workingDir for this test
- seenCommits: make(map[string]bool),
subscribers: []chan *AgentMessage{},
config: AgentConfig{
SessionID: "test-session",
InDocker: false,
},
history: []AgentMessage{},
+ gitState: AgentGitState{
+ seenCommits: make(map[string]bool),
+ },
}
// Create sketch-base-test-session tag at current HEAD to serve as the base commit
@@ -172,7 +174,7 @@
}
// Reset the seen commits map
- agent.seenCommits = make(map[string]bool)
+ agent.gitState.seenCommits = make(map[string]bool)
// Call handleGitCommits again - it should show up to 20 commits (or whatever git defaults to)
_, handleErr := agent.handleGitCommits(ctx)