(root: &Path)
| 1771 | } |
| 1772 | |
| 1773 | fn warn_if_view_mismatch(root: &Path) { |
| 1774 | let atomic_view = match fs::read_to_string(root.join(".atomic/current_view")) { |
| 1775 | Ok(view) => view.trim().to_string(), |
| 1776 | Err(_) => return, |
| 1777 | }; |
| 1778 | let git_branch = GitRepository::open(root).ok().and_then(|repository| { |
| 1779 | repository |
| 1780 | .head() |
| 1781 | .ok() |
| 1782 | .and_then(|head| head.shorthand().ok().map(str::to_string)) |
| 1783 | }); |
| 1784 | if let Some(git_branch) = git_branch { |
| 1785 | if !atomic_view.is_empty() && git_branch != atomic_view { |
| 1786 | print_warning(&format!( |
| 1787 | "git is on '{git_branch}' but the Atomic view is '{atomic_view}'; run 'atomic status --no-reconcile' before taking action" |
| 1788 | )); |
| 1789 | } |
| 1790 | } |
| 1791 | } |
| 1792 | |
| 1793 | pub(super) fn canonical_root(root: &Path) -> CliResult<PathBuf> { |
| 1794 | fs::canonicalize(root).map_err(|error| { |
no test coverage detected