Skip to content

I2993 — doctor counts the work no remote holds in one walk, whatever the number of branches

Make doctor's `clone unpushed` reading one walk of the clone: the commits some branch reaches and no remote does, with their parents (`git rev-list --parents --branches --not --remotes`), and every branch's tip (`git for-each-ref`). Each branch's count is the commits of that set its tip reaches, walked inside the set. The finding, its wording and its counts are what the per-branch `rev-list --count` gave.

DONE wave 0 · p1 · implementation profile · parallel safe

Part of a-second-adopter-is-served — A second adopter is served: what a foreign repository met on its first day is fixed in the tool.

Objective

Make doctor's `clone unpushed` reading one walk of the clone: the commits some branch reaches and no remote does, with their parents (`git rev-list --parents --branches --not --remotes`), and every branch's tip (`git for-each-ref`). Each branch's count is the commits of that set its tip reaches, walked inside the set. The finding, its wording and its counts are what the per-branch `rev-list --count` gave.

Why

An adopter's 0.29.0 field report (prismatic-platform, 2026-10-18, item 15) found doctor's wall time 55-96 s against its 40 s budget. In this repository's own commit hooks on 2026-10-18, doctor took 828 s against a budget of 100 s (policy benchmark.budget.doctor_ms), in every seat. The `clone` section ran one `git rev-list --count <branch> --not --remotes` per local branch: 609 branches at about 0.4 s each under load. The release seat named it the biggest throughput fix on the table.

Current state

mj_report_clone runs one rev-list per local branch, so doctor's time grows with the branch count and every commit hook pays it.

Desired state

One rev-list and one for-each-ref, whatever the number of branches; the same branches named with the same counts.

Scope

  • lib/doctor.sh
  • test/cases/3384_doctor_reads_unpushed_in_one_pass.sh

Dependencies

None. This issue is a root of the graph.

Acceptance criteria

  • A branch on a remote is not named, a branch two commits ahead is named with 2, and a branch that merged another unpushed branch counts each commit it reaches once
  • Every count equals the per-branch `git rev-list --count <branch> --not --remotes`
  • doctor walks the commits no remote holds once for 156 branches; the per-branch version walks them 156 times and the case fails

Validation

  • bash test/run.sh 3384_doctor_reads_unpushed_in_one_pass 02_doctor_basic 276_disk_is_bounded

Evidence required

  • case_doctor_one_walk

Evidence

coverstypecommandresultat commit
case_doctor_one_walkcivalidate run 39438896504 at master 9a5a9b77520: suite shards 1-4 (jobs 118683336189 118683338077 118683336157 118683336457) run every case, incl. 3384_doctor_reads_unpushed_in_one_pass (ba44bed3fd1)success (the run's only red job is pages, which runs no test)a81b1e3

Timeline

started
2026-10-20T16:18:53Z
verified
—
completed
2026-10-20T16:33:16Z

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I2993.yaml. Read it back with majordomus plan show I2993.

Searches the titles and descriptions of every page this site publishes.