Skip to content

Fix: #328 Use BFS to collect all commits in walk_commits_to_base#333

Merged
acunniffe merged 3 commits intogit-ai-project:mainfrom
txf0096:fix/bfs-walk-commits-rebase-merges
Jan 18, 2026
Merged

Fix: #328 Use BFS to collect all commits in walk_commits_to_base#333
acunniffe merged 3 commits intogit-ai-project:mainfrom
txf0096:fix/bfs-walk-commits-rebase-merges

Conversation

@txf0096
Copy link
Copy Markdown
Contributor

@txf0096 txf0096 commented Jan 8, 2026

The walk_commits_to_base function was only following parent(0), causing it to miss commits from merged branches when using git rebase --rebase-merges. This resulted in AI authorship being lost for side branch commits.

Changed from linear traversal (parent(0) only) to BFS (Breadth-First Search) that traverses all parents, ensuring merge commits' second parents are not missed.

Fixes #328

…ase-merges support

The walk_commits_to_base function was only following parent(0), causing it to
miss commits from merged branches when using git rebase --rebase-merges. This
resulted in AI authorship being lost for side branch commits.

Changed from linear traversal (parent(0) only) to BFS (Breadth-First Search)
that traverses all parents, ensuring merge commits' second parents are not
missed.

Fixes git-ai-project#328
@svarlamov svarlamov requested a review from acunniffe January 17, 2026 20:34
Copy link
Copy Markdown
Collaborator

@acunniffe acunniffe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved and adding a test! Thanks for the contribution

@acunniffe acunniffe force-pushed the fix/bfs-walk-commits-rebase-merges branch from 1aac8dd to 9bf2d92 Compare January 18, 2026 22:53
@acunniffe acunniffe merged commit 3097292 into git-ai-project:main Jan 18, 2026
6 checks passed
@txf0096 txf0096 deleted the fix/bfs-walk-commits-rebase-merges branch January 19, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: test_rebase_preserve_merges fails - Side branch commits lost during --rebase-merges

2 participants