Migrate remote-tidy onto the CleanPipeline seam#204
Merged
Conversation
Rewrite git-remote-tidy's hand-rolled clean loop to delegate to the shared git_tidy_core::clean::run_clean seam (issue #118 step 3). The public run_clean signature and CleanResult<RemovedRemote> return type are unchanged, so no callers or tests required edits. Remotes are grouped per repo, so the seam is invoked once per RepoGroup and the per-group CleanResults are accumulated into the combined succeeded/failed/skipped buckets; this keeps each group's repo_path and name stable for that call's act closure while leaving the loop oblivious to grouping. The decide predicate is the existing should_clean classification filter unchanged: with --all it admits any non-Active remote, otherwise only Unreachable. The prune-vs-remove split is preserved verbatim inside act: orphaned remotes have their tracking refs pruned via prune_remote_refs (emitting "pruned N refs for ...", carrying the per-remote count in RemovedRemote.refs_pruned), while configured/unreachable remotes are removed via remote_remove (emitting "removed ..."); dry-run short-circuits both with the original "would prune refs for"/"would remove" wording and refs_pruned 0. Origin protection stays an act-level guard rather than a decide filter because it prints a warning before skipping: removing the origin remote without --force writes "warning: skipping origin remote in ... (use --force to remove)" and returns Outcome::Skipped. Success maps to Outcome::Cleaned(RemovedRemote), action failures to Outcome::Failed(FailedItem) so the loop continues. Refs #118
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 3 of #118 (4 of 5). Moves
git-remote-tidyontogit_tidy_core::clean::run_clean.CleanResult<RemovedRemote>unchanged.The prune-vs-remove split is preserved verbatim in
act: orphaned remotes prune tracking refs (count carried inrefs_pruned), configured/unreachable remotes are removed. Origin protection stays anact-level guard (prints the warning, returnsOutcome::Skipped) rather than adecidefilter, matching the original.Behavior-preserving: all existing tests pass unchanged. Local CI green.
Refs #118