drop the 1000 commits limit when cherrypicking/rebasing the commits during pre-push
- User
drop the 1000 commits limit when cherrypicking/rebasing the commits during pre-push
Assistant· claude-opus-4-8
I'll start by finding where this 1000 commit limit lives in the pre-push code path.
Assistant· claude-opus-4-8
The relevant one for pre-push is in
push_common.go:519. Let me examine that context.Assistant· claude-opus-4-8
Let me confirm where
collectCommitsSinceandcherryPickOntoare used to ensure this is the pre-push path.Assistant· claude-opus-4-8
collectCommitsSinceis used in two spots. Let me look at common.go:176 context to understand if it's also part of the push flow.Assistant· claude-opus-4-8
Both callers are in the push/rebase replay flow. The limit to drop is at
push_common.go:519. Let me also checkcollectCommitChainsince it's used in the disconnected-ref replay during push.Assistant· claude-opus-4-8
Let me check all callers of
collectCommitChainto understand the full pre-push replay surface.Assistant· claude-opus-4-8
Let me look at the existing tests for these limits to understand what behavior is asserted.
Assistant· claude-opus-4-8
Let me confirm these helpers are reached during the actual pre-push flow.
Assistant· claude-opus-4-8
This is the pre-push rebase-onto-remote path. Now I have the full picture. The 1000-commit limit appears in two replay helpers that feed
cherryPickOntoduring pre-push:collectCommitsSince(push_common.go:519) — rebase local-only commits onto remote tipcollectCommitChain(metadata_reconcile.go:246) — full-chain replay for disconnected refs
Both gate the cherry-pick/rebase set with
MaxCommitTraversalDepth. There's also an existing test asserting the limit. Since this is a behavior change with an existing test, I'll follow TDD.Assistant· claude-opus-4-8
Following TDD: first I'll rewrite the test to express the new behavior (RED). The existing
TestCollectCommitChain_DepthLimitasserts the old limit. Let me replace it with a test asserting the chain now walks past the legacy limit to the real root.Assistant· claude-opus-4-8
Now run the test to verify it fails for the expected reason (RED):
Assistant· claude-opus-4-8
RED confirmed — fails because of the limit. Now implement GREEN. First
collectCommitChain:Assistant· claude-opus-4-8
Now
collectCommitsSincein push_common.go:Assistant· claude-opus-4-8
The line 296 diagnostic is in
loadShallowHashes, which I didn't touch — pre-existing code. Let me verify GREEN now.Assistant· claude-opus-4-8
Let me check the other
MaxCommitTraversalDepthusage in common.go:284 to see if it's part of the same cherry-pick/rebase path the task targets.Assistant· claude-opus-4-8
IsAncestorOfis a bounded ancestry check, not the replay itself. Let me check whether it's on the pre-push path, since a stale cap there could misreport ancestry for deep histories.Assistant· claude-opus-4-8
IsAncestorOfhas no production callers — out of scope, leaving it. Now let me run the full strategy package tests to confirm nothing regressed.Assistant· claude-opus-4-8
All pass. Now let me check whether docs reference this limit (the CLAUDE.md mentions push/rebase behavior) and run the full check sequence.
Assistant· claude-opus-4-8
No doc references. Let me run fmt and lint to verify the changes are clean.
Assistant· claude-opus-4-8
Lint passes with 0 issues (confirming the editor diagnostics were pre-existing, not enforced). Let me do a final check for any other references to the removed error message across the repo.
Assistant· claude-opus-4-8
No lingering references. Done.
Summary
Dropped the 1000-commit (
MaxCommitTraversalDepth) cap from the two replay helpers that feedcherryPickOntoduring pre-push:collectCommitsSince(push_common.go) — the rebase-onto-remote path. Removed thelen(lines) > MaxCommitTraversalDepthguard that aborted with"commit chain exceeded N commits; aborting rebase".collectCommitChain(metadata_reconcile.go) — the disconnected-ref full-chain replay. Replaced the boundedfor range MaxCommitTraversalDepthloop (and itsreachedRoot"without reaching root" error) with an unbounded first-parent walk. This is safe: a git DAG is acyclic and finite, so the walk always terminates at a root, a shallow boundary, or errors on a missing object.
- User
commit changes
Assistant· claude-opus-4-8
Before committing I need to check the working tree — the git status at session start already showed these three files as modified, meaning there were pre-existing uncommitted changes. Let me see the full diff so I show you exactly what would be committed.
Assistant· claude-opus-4-8
The diff is entirely my change — limit removal plus the test rewrite, nothing extraneous. Before committing, CLAUDE.md requires the full check to pass. fmt and lint are already green; let me run the test suite.
- User
[Request interrupted by user for tool use]
- User
go ahead and just commit the changes
Assistant· claude-opus-4-8
Committed to
no-limitas4cf01edb3. Three files changed (21 insertions, 22 deletions) — the cap removal incollectCommitsSinceandcollectCommitChain, plus the rewritten test.Note: per your interruption, I skipped the full
mise run test:ci.mise run fmt,mise run lint(0 issues), and thestrategypackage tests all passed before the commit, but integration and e2e-canary did not run this session — worth letting CI cover those.