(&self)
| 578 | |
| 579 | impl Command for Shim { |
| 580 | fn run(&self) -> CliResult<()> { |
| 581 | match &self.command { |
| 582 | ShimCommand::Reconcile => reconcile(), |
| 583 | ShimCommand::Verify => { |
| 584 | verify()?; |
| 585 | print_success("Git HEAD matches the current Atomic view"); |
| 586 | Ok(()) |
| 587 | } |
| 588 | ShimCommand::Switch { view } => switch(view), |
| 589 | ShimCommand::Status => super::ref_mapping::run_status(), |
| 590 | ShimCommand::Publish { view, branch } => super::ref_mapping::run_publish(view, branch), |
| 591 | ShimCommand::Enable { |
| 592 | mirror_ignores, |
| 593 | adopt_atomic, |
| 594 | adopt_git, |
| 595 | binding_key_file, |
| 596 | with_changes_pack, |
| 597 | remote, |
| 598 | no_refspecs, |
| 599 | } => { |
| 600 | let root = find_repository_root()?; |
| 601 | // The explicitly unavailable flag refuses before any mutation. |
| 602 | if *adopt_git { |
| 603 | return Err(anchor::adopt_git_refusal()); |
| 604 | } |
| 605 | hooks::enable_shim(&root, *mirror_ignores)?; |
| 606 | // Review R4: the explicit CLI enable IS the consent, so it |
| 607 | // is recorded where it is consumed. The repository |
| 608 | // configuration now records `[git.shim] enabled = true`; |
| 609 | // `git shim disable` rolls it back. |
| 610 | if record_shim_opt_in(&root, true)? { |
| 611 | print_info( |
| 612 | "Recorded explicit shim opt-in in the repository configuration ([git.shim] enabled = true).", |
| 613 | ); |
| 614 | } |
| 615 | // Report the default-enablement gate honestly (review R4: |
| 616 | // the helper gains a real consumer). Explicit opt-in is |
| 617 | // experimental consent, never default-rollout approval. |
| 618 | match shim_config(&root)?.git.shim.default_enablement() { |
| 619 | Ok(()) => print_info( |
| 620 | "All rollout gates are measured and passed; default (automatic) enablement still requires recorded owner approval of the thresholds.", |
| 621 | ), |
| 622 | Err(refusal) => print_info(&format!( |
| 623 | "Default (automatic) enablement remains refused: {refusal}" |
| 624 | )), |
| 625 | } |
| 626 | if *mirror_ignores { |
| 627 | hooks::mirror_ignores_with_consent(&root)?; |
| 628 | } |
| 629 | // CB-10B (RFC §8.6): explicit fetch refspecs on enable, before |
| 630 | // the anchor phase. A missing remote is a notice, not an |
| 631 | // error — binding refs need a configured remote to transfer. |
| 632 | if !*no_refspecs { |
| 633 | let git = open_git(&root)?; |
| 634 | match super::transport::configure_fetch_refspecs(&git, remote) { |
| 635 | Ok(0) => print_info(&format!( |
| 636 | "Fetch refspecs for refs/atomic/bindings/* and refs/atomic/views/* already configured on '{remote}'." |
| 637 | )), |
no test coverage detected