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

Function require_clean_git_worktree

atomic-cli/src/commands/git/shim.rs:2849–2870  ·  view source on GitHub ↗
(git: &GitRepository)

Source from the content-addressed store, hash-verified

2847}
2848
2849pub(crate) fn require_clean_git_worktree(git: &GitRepository) -> CliResult<()> {
2850 let index = git
2851 .index()
2852 .map_err(|error| git_error(format!("cannot read Git index: {error}")))?;
2853 if index.has_conflicts() {
2854 return Err(git_error("Git index contains unresolved conflicts"));
2855 }
2856
2857 let mut options = GitStatusOptions::new();
2858 options
2859 .include_untracked(false)
2860 .recurse_untracked_dirs(false);
2861 let statuses = git
2862 .statuses(Some(&mut options))
2863 .map_err(|error| git_error(format!("cannot inspect Git status: {error}")))?;
2864 if statuses.iter().any(|entry| tracked_delta(entry.status())) {
2865 return Err(git_error(
2866 "Git has staged or unstaged changes to tracked paths",
2867 ));
2868 }
2869 Ok(())
2870}
2871
2872fn require_matching_clean_workspaces<'repo>(
2873 repo: &Repository,

Callers 8

run_publishFunction · 0.85
verifyFunction · 0.85
verify_atFunction · 0.85
verify_withFunction · 0.85

Calls 7

tracked_deltaFunction · 0.85
include_untrackedMethod · 0.80
git_errorFunction · 0.70
indexMethod · 0.45
has_conflictsMethod · 0.45
iterMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected