MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / warn_if_view_mismatch

Function warn_if_view_mismatch

atomic-cli/src/commands/git/hooks.rs:1804–1822  ·  view source on GitHub ↗
(root: &Path)

Source from the content-addressed store, hash-verified

1802}
1803
1804fn 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
1824pub(super) fn canonical_root(root: &Path) -> CliResult<PathBuf> {
1825 fs::canonicalize(root).map_err(|error| {

Callers 1

record_post_checkoutFunction · 0.85

Calls 5

print_warningFunction · 0.85
openFunction · 0.50
okMethod · 0.45
headMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected