Build the real per-file unified diff for a recorded change WITHOUT printing. This is the computation `atomic diff -c ` runs, factored out so other surfaces (e.g. the triage report) can embed actual code hunks instead of re-implementing diffing. It returns every changed file's [`FileDiff`] plus the aggregate [`DiffStats`], using the semantic layer (FileOps) with true hunk offsets and before-
(
repo: &Repository,
change: &Change,
change_hash: &Hash,
config: &DiffOutputConfig,
)
| 946 | /// `atomic diff` path applies `filter_file_diffs` afterward, which yields the |
| 947 | /// same result as the previous in-loop filtering. |
| 948 | pub(crate) fn change_file_diffs( |
| 949 | repo: &Repository, |
| 950 | change: &Change, |
| 951 | change_hash: &Hash, |
| 952 | config: &DiffOutputConfig, |
| 953 | ) -> CliResult<(Vec<FileDiff>, DiffStats)> { |
| 954 | projected_change_file_diffs_with( |
| 955 | change, |
| 956 | config, |
| 957 | |path| { |
| 958 | repo.get_file_content_before_change(path, change_hash) |
| 959 | .map_err(CliError::Repository) |
| 960 | }, |
| 961 | |path| { |
| 962 | repo.get_file_content_after_change(path, change_hash) |
| 963 | .map_err(CliError::Repository) |
| 964 | }, |
| 965 | ) |
| 966 | } |
| 967 | |
| 968 | pub(crate) fn projected_change_file_diffs_with<B, A>( |
| 969 | change: &Change, |