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

Method squash_insert_matches_tree

atomic-cli/src/commands/git/parallel.rs:5629–5660  ·  view source on GitHub ↗

Whether the target view's materialized content for every path the squash touches matches the git tree recorded in `parsed`.

(
        &self,
        repo: &Repository,
        parsed: &ParsedCommit,
        target: &str,
    )

Source from the content-addressed store, hash-verified

5627 /// Whether the target view's materialized content for every path the squash
5628 /// touches matches the git tree recorded in `parsed`.
5629 fn squash_insert_matches_tree(
5630 &self,
5631 repo: &Repository,
5632 parsed: &ParsedCommit,
5633 target: &str,
5634 ) -> bool {
5635 for file in &parsed.files {
5636 match file.operation {
5637 FileOperation::Deleted => {
5638 // The path must be absent (or empty) in the target view.
5639 if let Ok(Some(content)) =
5640 repo.get_file_content_on_view(&*repository_path(&file.path), target)
5641 {
5642 if !content.is_empty() {
5643 return false;
5644 }
5645 }
5646 }
5647 _ => {
5648 let expected = match &file.new_content {
5649 Some(c) => c,
5650 None => continue,
5651 };
5652 match repo.get_file_content_on_view(&*repository_path(&file.path), target) {
5653 Ok(Some(actual)) if &actual == expected => {}
5654 _ => return false,
5655 }
5656 }
5657 }
5658 }
5659 true
5660 }
5661
5662 /// Write a single commit to the repository.
5663 ///

Callers 1

try_squash_insertMethod · 0.80

Calls 3

repository_pathFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected