(root: &Path)
| 1802 | } |
| 1803 | |
| 1804 | fn warn_if_view_mismatch(root: &Path) { |
| 1805 | let atomic_view = match fs::read_to_string(root.join(".atomic/current_view")) { |
| 1806 | Ok(view) => view.trim().to_string(), |
| 1807 | Err(_) => return, |
| 1808 | }; |
| 1809 | let git_branch = GitRepository::open(root).ok().and_then(|repository| { |
| 1810 | repository |
| 1811 | .head() |
| 1812 | .ok() |
| 1813 | .and_then(|head| head.shorthand().ok().map(str::to_string)) |
| 1814 | }); |
| 1815 | if let Some(git_branch) = git_branch { |
| 1816 | if !atomic_view.is_empty() && git_branch != atomic_view { |
| 1817 | print_warning(&format!( |
| 1818 | "git is on '{git_branch}' but the Atomic view is '{atomic_view}'; run 'atomic status --no-reconcile' before taking action" |
| 1819 | )); |
| 1820 | } |
| 1821 | } |
| 1822 | } |
| 1823 | |
| 1824 | pub(super) fn canonical_root(root: &Path) -> CliResult<PathBuf> { |
| 1825 | fs::canonicalize(root).map_err(|error| { |
no test coverage detected