Repository navigation
Conversation
… ref The copy rule compared each local branch with every local branch's upstream, one `rev-list --cherry-mark` pair per ref. That is quadratic in the branches: a kinisi_ros clone with 36 branches spent 20 s of its `dl --ls` row in 146 of those spawns. Ask about all of a branch's remote refs in one `rev-list`, one symmetric range per ref. For a commit no remote ref reaches, the walk gives the same candidates as one question per ref, and the byte-for-byte patch check and the replay check that confirm each copy are unchanged. `--ignore-missing` drops a range whose ref is not there, as one question per ref refused that ref alone.
Reviewer's GuideAPIReview the batched
ImplementationReview how unpushed branches now skip work once their commits are accounted for and otherwise make one copy-rule call with all relevant remote refs.
DocumentationReview the unreleased changelog entry describing the reduction in per-branch Git queries.
TestsReview the Git-client test updates for the new arguments and slice-based call, alongside the workspace-state coverage for missing refs and one query per branch.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report❌ Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
blooop
left a comment
There was a problem hiding this comment.
This was generated by AI during review.
wf-review of 2b8f8036 against merge-base with main, fresh context.
Standards
No blocking findings. The change is small (one signature, one loop), the names say what they do, and none of the Fowler smells applies. The doc comments on patches_already_on and already_on_a_remote say why one question gives the same answer, and the repo's citation and changelog rules are kept.
Correctness, checked against real git 2.56.1, not only read:
- Same answer. In a scratch repo, a branch with unpushed
X,Y, a copy ofXonorigin/other, an unrelatedorigin/third, and a missingorigin/missing: the per-ref questions markX=only againstorigin/other, and refuseorigin/missing. The one combined question (--ignore-missing, four ranges) marksX=andY+, and its--right-onlyside holds exactly the copy plus the unrelated commit. This matches the argument in the PR body: every common ancestor oftipand a ref is behind one of that pair's merge bases, so the left side istipminus all refs and the right side is the union of the per-ref right sides. --ignore-missing. A range with a missing right end is dropped alone, and a question whose every range is missing prints nothing with exit 0 (old: a refusal). Both mean "nothing cleared", so the count is unchanged.- Tests.
cargo test --locked --workspace --no-fail-fast: 3295 passed, 0 failed.cargo clippy --locked --all-targets -- -D warnings: clean. The real-git testa_backup_made_before_the_remote_rebase_holds_nothing_unsavedcovers the missing-ref range end to end; the new scripted test pins one question per branch.
Non-blocking notes:
- (info) A git refusal of the combined question now clears nothing for the whole branch, where it used to lose one ref. That is the safe side, as the "Every failure here counts less as copied" comment promises, so no change is asked for.
- (info)
--ignore-missingalso drops a range whose left end is missing, silently.tipcomes fromfor-each-refa moment earlier, so only a race with a branch delete reaches this, and the result is again "nothing cleared". - (nit) The
CHANGELOG.mdheadline saysdl --ls"no longer spends most of a minute". On the clone in the evidence the row still takes about 24 s, now in the squash rule. The body of the entry is exact; the headline could say "half a minute less" or name the check.
PR body: describes the code at this head, gives the why, the evidence, and the scope limits (squash rule left for its own change). A reader who has not seen a ticket gets the change from it alone.
Spec
No spec available. The PR closes no issue, and its commits reference none. Behavior was checked against the PR body's own claim (same answer, one question per branch) under Standards above.
Verdict
Approve. No blocking findings. Note 3 is optional. (Posted as a comment review, since GitHub refuses an approval from the PR's own account.)
The squash rule still takes most of a --ls row after this change.
…-quadratic # Conflicts: # CHANGELOG.md
The unpushed-work check now asks git one question per local branch, not one per branch and remote ref. On one kinisi_ros clone, the row for
dl --lsfalls from 50.4 s to 23.9 s, and the answer is the same.In short
dl rmanddl --lsboth count the commits in a clone that no remote holds. The copy rule clears a commit when a remote ref holds a copy of it (a rebase, a cherry-pick, or a one-commit squash).The copy rule compared each local branch with a list of remote refs: the upstream of every local branch,
origin/<branch>, andorigin/HEAD. It ran tworev-list --cherry-markcommands for each branch and each ref. The list grows with the branches, so the cost grew with the square of the branches. On a kinisi_ros clone with 36 branches, the copy rule spent 20 s in 146 of these commands.dl --ls --jsonon this host did not finish in 100 s.Now the copy rule runs one
rev-listfor each branch, with onetip...refrange for each ref. The confirmation of each copy does not change: the patch must be the same byte for byte, andmerge-treemust replay the commit as the copy.Evidence
The test is
account_of(the function that makes onedl --lsrow) on acp -acopy of the.gitof the clonekinisi-ros-proto-kinisi-ros-12125-sim-rc-e3pm. The clone has 36 local branches, 41 tags and 3981 remote refs. The copy has its work tree fromHEAD. A wrapper onPATHtimed eachgitcommand. Debug build, git 2.56.1.gitspawns.rev-list --cherry-mark: 19.68 smerge-tree --stdin(the squash rule): 19.76 sgitspawns.rev-list --ignore-missing --cherry-mark: 0.46 smerge-tree --stdin(the squash rule): 20.21 sholdsvalue (md57277c0862ec816463c716559923ac65c), with 265 commits counted.Before the change to the code, a script compared the two forms of the query directly on the copy, for each of the 36 branches. For each branch, the set of unpushed commits that the query marks
=was the same.Why the answer stays the same
A walk over all the ranges
tip...ref1 tip...ref2 ...leaves out each merge base, so it leaves out all that the tip shares with any of the refs.So an unpushed commit has a copy on the right side here if and only if it had a copy on one ref before. A commit that one of the refs already reaches drops off the left side. No count holds such a commit, so nothing asks about it.
--ignore-missingdrops a range whose ref does not exist, for exampleorigin/<branch>for a branch that was never pushed. Before, git refused that one ref, and the other refs still gave their answer. Now git drops that one range, and the other ranges still give their answer. The testa_backup_made_before_the_remote_rebase_holds_nothing_unsavedhas this shape.What changes
Git::patches_already_oninrust/devlaunch-core/src/clients/git.rstakes&[RemoteRef], not one&RemoteRef. It asksrev-list --ignore-missing --cherry-mark --left-only --no-mergeswith one range for each ref. It asks--right-onlyonly when the left side has a match.already_on_a_remoteinrust/devlaunch-core/src/domain/workspace_state.rscalls it once for each branch. It skips a branch when the rules already cleared all of the unpushed commits on that branch.CHANGELOG.mdhas an entry under[Unreleased].Tests
each_branch_is_compared_with_all_its_remote_refs_in_one_question. It gives 12 branches with an upstream each and checks for 12 questions, one for each branch. Each question has 13 ranges, and the arguments are pinned. The old code made 156 questions here.a_patch_match_is_a_copy_only_when_git_replays_it_as_the_copypins the newrev-listarguments.cargo test --locked --workspace: 3295 passed, 0 failed.cargo clippy --locked --all-targets -- -D warningsandcargo fmt --check: clean.prekon the changed files: clean.What this does not change
dl --lsstill runs the full check.unsavedin--ls --jsonis part of the contract thatwf reapreads to decide what to remove, so a cheaper and weaker status there is not safe. The check is now cheap enough to keep.squashed_onto_a_remote) is now the largest cost: 20 s for this clone, in 6merge-tree --stdincommands of up to 8 points times 18 refs each. It is a batch, not a spawn for each pair, andMERGE_BUDGETbounds it. A fix for it needs its own change.🤖 Generated with Claude Code
Summary by Sourcery
Make unpushed-work detection scale with local branches instead of branch and remote-reference pairs.
Bug Fixes:
Enhancements:
Tests: