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,
)
| 2863 | /// Whether the target view's materialized content for every path the squash |
| 2864 | /// touches matches the git tree recorded in `parsed`. |
| 2865 | fn squash_insert_matches_tree( |
| 2866 | &self, |
| 2867 | repo: &Repository, |
| 2868 | parsed: &ParsedCommit, |
| 2869 | target: &str, |
| 2870 | ) -> bool { |
| 2871 | for file in &parsed.files { |
| 2872 | match file.operation { |
| 2873 | FileOperation::Deleted => { |
| 2874 | // The path must be absent (or empty) in the target view. |
| 2875 | if let Ok(Some(content)) = repo.get_file_content_on_view(&file.path, target) { |
| 2876 | if !content.is_empty() { |
| 2877 | return false; |
| 2878 | } |
| 2879 | } |
| 2880 | } |
| 2881 | _ => { |
| 2882 | let expected = match &file.new_content { |
| 2883 | Some(c) => c, |
| 2884 | None => continue, |
| 2885 | }; |
| 2886 | match repo.get_file_content_on_view(&file.path, target) { |
| 2887 | Ok(Some(actual)) if &actual == expected => {} |
| 2888 | _ => return false, |
| 2889 | } |
| 2890 | } |
| 2891 | } |
| 2892 | } |
| 2893 | true |
| 2894 | } |
| 2895 | |
| 2896 | /// Write a single commit to the repository. |
| 2897 | /// |
no test coverage detected