Skip to main content

diff_snapshots

Function diff_snapshots 

Source
pub fn diff_snapshots(
    left: &Path,
    right: &Path,
) -> Result<DiffResult, GitClosureError>
Expand description

Compares two .gcl snapshot files and returns the set of differences.

The returned DiffResult is in a deterministic, sorted order suitable for human display and golden-file tests.

§Rename detection

A file is reported as Renamed when a path disappears from the left snapshot and a path with the same SHA-256 appears in the right snapshot. When there are multiple candidates (duplicate content), the lexicographically smallest new path is chosen. This is O(n log n) via a reverse-index over the right snapshot’s sha256 values.

Symlinks are compared by target string, not sha256 (which is empty for symlinks). Two symlinks with the same target pointing to the same path are considered identical; different targets are SymlinkTargetChanged.