Date fiddlin'

This commit is contained in:
Andy Dixon
2026-09-26 17:19:12 +01:00
parent 9e79931d27
commit 285bc8328c
3 changed files with 101 additions and 7 deletions
+23
View File
@@ -402,3 +402,26 @@ func TestStageDateSpreadOrdersTimestampsWithinWindow(t *testing.T) {
t.Fatal("expected inverted window to be rejected")
}
}
func TestAICommitHashesIncludesMergesOfAIBranches(t *testing.T) {
commits := []CommitRecord{
{Hash: "root", Message: "init"},
{Hash: "human", Parents: []string{"root"}, Message: "human work"},
{Hash: "bot", Parents: []string{"root"}, AuthorName: "Codex", Message: "feature"},
{Hash: "trailer", Parents: []string{"human"}, Message: "fix\n\nCo-Authored-By: Claude <noreply@anthropic.com>"},
{Hash: "mergeAI", Parents: []string{"trailer", "bot"}, Message: "Merge branch 'feature'"},
{Hash: "side", Parents: []string{"root"}, Message: "plain"},
{Hash: "mergePlain", Parents: []string{"mergeAI", "side"}, Message: "Merge branch 'other'"},
}
got := aiCommitHashes(commits)
for _, h := range []string{"bot", "trailer", "mergeAI"} {
if !got[h] {
t.Errorf("%s should be flagged", h)
}
}
for _, h := range []string{"root", "human", "side", "mergePlain"} {
if got[h] {
t.Errorf("%s should not be flagged", h)
}
}
}