Repository navigation
feat: doctor and adopt - #17
simonostendorf wants to merge 6 commits into
Conversation
Detection only, no writes. A deliberate pin marked gitcd.profile is told apart from stale config, and a global identity key is reported wherever it sits, because useConfigOnly cannot suppress one. Refs #4
doctor exits non zero while any finding stands, so a prompt or a pipeline can read it. --fix repairs only the mechanical findings and never touches an identity key it did not write. adopt refuses a repository with extensions.worktreeConfig rather than guessing which config file to write, and moves nothing without being asked. Refs #4
|
Verdict: changes requested Independent review, round 1. What holds up. A fully healthy tree exits 0 with Blocker
Probe, adopting a linked worktree: A routine The other direction is immediate, with no prune needed. Adopting a main checkout that has a
Fix: refuse a linked worktree before the move, by comparing
And it flips forever, moving every repository under the ancestor on each run while reporting Fix: before renaming an ancestor, check that every repository under it agrees on the new spelling. Should
Three bare managed file paths precede the object;
Nothing is lost, but the run leaves directories the user did not have and does not say so. Fix:
Nit
The Risk section's three items each check out: the Ready for the |
Renaming it fixed one repository and un-placed the other, so --fix flipped the directory back and forth, reporting success each time and moving everything underneath. The conflict is a finding now, naming both repositories, and --fix converges. Refs #4
adopt moved a linked worktree, or a main checkout that still had one, and reported success while leaving the other end at "not a git repository". Both directions are refused now, naming the git command that does move one safely. Also: a failed move no longer leaves the directories it created behind, the rename message names the ancestor that actually moved, an unreadable target counts as a conflict rather than as free, and --json stays valid JSON while --fix reports progress. Refs #4
|
Verdict: needs human Round 2, the final automated round. Round 1 findings
Blocker
Fix: in Should
The Fix: compute Nit
Graft checkIn a detached, source-only scratch copy (no The two fixed blockers hold up under direct attack and under three- and four-repository, |
What
internal/doctordetects identity drift, a repository at a path the layout would not render,a missing or stale managed file, a global identity key and its ordering, and a case mismatch.
Detection only; it writes nothing.
internal/gitgains a local boolean config read, forextensions.worktreeConfig.cmd/gitcdgainsdoctorwith--fix,--jsonand--dry-run, andadopt.Why
doctoris the fleet wide form ofgitcd profile show, built as a loop over the repositoriesplus the global checks rather than a second identity resolution.
user.useConfigOnlycannot suppress a key the global config sets directly, so a repository norule matches inherits it. fix: useConfigOnly does not protect an unmatched repository when a global identity exists #8 made
initable to move it; this makes the tool say it is there.--fixrepairs only the mechanical findings, the managed files and a case only path mismatch,and never touches an identity key it did not write. Everything identity related is reported
and left alone.
--fix, so a shellprompt or a pipeline can read it.
adoptrefuses a repository withextensions.worktreeConfigenabled rather than guessingwhich config file to write, and moves nothing without being asked.
Verification
task checkexit 0, eleven packages green with-race.global identity, one
doctorrun reported all of it, printed both config homes and exited 1:doctor --fixthen repaired exactly the two managed files, left the global identity and themisplaced repository untouched, and still exited 1.
adoptwas exercised through its refusal path, its safe default and a real move with a stalepin corrected.
Risk
doctorwalks onlyroot. A repository outside it that ahasconfigrule still covers is notchecked. That matches
list's own limitation and is recorded in the concept document ratherthan silently assumed.
doctorusescmd/gitcd/discover.go, deliberately, rather than adding a third walk. refactor: one walk over root, not two #15reconciles it with
internal/scanonce feat: list and cd with fuzzy matching #3 lands.passed only because macOS has a case insensitive filesystem, and a case only rename that did
nothing when the mismatch sat in a parent directory rather than the leaf.
Closes #4
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.