From c011080b97c693f0a7377b7fe78fb2b33b33e28e Mon Sep 17 00:00:00 2001 From: yellowsink Date: Sat, 14 Sep 2024 17:01:59 +0100 Subject: [PATCH] hotfix: fix diffing with relative roots --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/foldiff.rs | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d5ed64..ed5e7d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -253,7 +253,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldiff" -version = "0.1.0" +version = "1.0.1" dependencies = [ "anyhow", "clap", diff --git a/Cargo.toml b/Cargo.toml index c2f15b8..0907667 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "foldiff" authors = ["Hazel Atkinson"] -version = "0.1.0" +version = "1.0.1" edition = "2021" license-file = "LICENSE.md" description = "A general purpose diffing tool that operates on folders of mixed text/binary files." diff --git a/src/foldiff.rs b/src/foldiff.rs index c001131..116573a 100644 --- a/src/foldiff.rs +++ b/src/foldiff.rs @@ -437,16 +437,15 @@ impl DiffingDiff { if ftype.is_symlink() { bail!("Entry at '{:?}' is a symlink, bailing", entry.path()); } + // strip the root off the front of the path else we get errors + let path = entry.path(); + let path = path.strip_prefix(&root)?; if ftype.is_dir() { // recurse - self.scan_internal(&entry.path(), new, spinner)?; + self.scan_internal(&path, new, spinner)?; } else { // file found! - // strip the root off the front of the path - // else we get errors in add_file - let path = entry.path(); - let path = path.strip_prefix(&root)?; self.add_file(new, path).context("While adding file to diff")?; }