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:1773–1791  ·  view source on GitHub ↗
(root: &Path)

Source from the content-addressed store, hash-verified

1771}
1772
1773fn 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
1793pub(super) fn canonical_root(root: &Path) -> CliResult<PathBuf> {
1794 fs::canonicalize(root).map_err(|error| {

Callers 1

record_post_checkoutFunction · 0.85

Calls 5

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

Tested by

no test coverage detected