Execute the status command. This method: 1. Finds and opens the repository 2. Computes the working copy status 3. Displays the status in the requested format # Errors Returns an error if: - No repository is found - The repository cannot be opened - Status computation fails
(&self)
| 712 | /// - The repository cannot be opened |
| 713 | /// - Status computation fails |
| 714 | fn run(&self) -> CliResult<()> { |
| 715 | // A shim-enrolled repository's linked worktrees are not managed yet: |
| 716 | // refuse before any constructor registers a second working copy there. |
| 717 | crate::commands::git::linked_worktree::refuse_when_shim_enrolled_from_cwd()?; |
| 718 | if crate::commands::rpc::status(self)? { |
| 719 | return Ok(()); |
| 720 | } |
| 721 | |
| 722 | // Find the repository root |
| 723 | let repo_root = find_repository_root()?; |
| 724 | |
| 725 | // Git-inspired, versioned staging subset (observation-only). |
| 726 | if self.git { |
| 727 | return crate::commands::status_git::run_git_status(&repo_root, self.json); |
| 728 | } |
| 729 | |
| 730 | if self.no_reconcile { |
| 731 | let mut repo = |
| 732 | Repository::open_readonly(&repo_root).map_err(|e| CliError::InvalidRepository { |
| 733 | reason: e.to_string(), |
| 734 | })?; |
| 735 | match observe_workspace(&mut repo)? { |
| 736 | Ok(workspace) => { |
| 737 | let view = workspace.view().name.clone(); |
| 738 | let result = print_forensic_status(&repo_root, &repo, &view, None); |
| 739 | // CB-10A: surface ref-mapping divergence (read-only). |
| 740 | let _ = crate::commands::git::ref_mapping::print_divergence_notices(&repo); |
| 741 | return result; |
| 742 | } |
| 743 | Err(remediation) => { |
| 744 | let working_copy = repo.require_working_copy_id().map_err(|e| { |
| 745 | CliError::InvalidRepository { |
| 746 | reason: e.to_string(), |
| 747 | } |
| 748 | })?; |
| 749 | let view = repo |
| 750 | .desired_view_name(working_copy) |
| 751 | .map_err(CliError::from)?; |
| 752 | let result = |
| 753 | print_forensic_status(&repo_root, &repo, &view, Some(&remediation)); |
| 754 | let _ = crate::commands::git::ref_mapping::print_divergence_notices(&repo); |
| 755 | return result; |
| 756 | } |
| 757 | } |
| 758 | } |
| 759 | |
| 760 | let mut repo = Repository::open_for_workspace_transaction_wait( |
| 761 | &repo_root, |
| 762 | std::time::Duration::from_secs(10), |
| 763 | ) |
| 764 | .map_err(|e| CliError::InvalidRepository { |
| 765 | reason: e.to_string(), |
| 766 | })?; |
| 767 | let working_copy = |
| 768 | repo.require_working_copy_id() |
| 769 | .map_err(|e| CliError::InvalidRepository { |
| 770 | reason: e.to_string(), |
| 771 | })?; |