M Cargo.lock +1 -1
@@ 290,7 290,7 @@ checksum = "e2abad23fbc42b3700f2f279844d
[[package]]
name = "legdur"
-version = "0.2.2"
+version = "0.3.0"
dependencies = [
"camino",
"hex",
M Cargo.toml +1 -1
@@ 1,7 1,7 @@
[package]
authors = ["Cyryl PÅ‚otnicki <cyplo@cyplo.dev>"]
name = "legdur"
-version = "0.2.3"
+version = "0.3.0"
edition = "2021"
rust-version = "1.56"
license = "AGPL-3.0"
M README.md +1 -1
@@ 31,7 31,7 @@ 2022-06-25T06:49:23.826715Z WARN legdur
## How it works
* it will compute a hash of each file present in the directory structure (it works recursively).
-* if previously computed `legdur.db` exists it will compare the current state of the world to the one represented by `legdur.db` and output any differences. Only files that changed or got deleted get printed out, additions are not.
+* if previously computed `legdur.db` exists it will compare the current state of the world to the one represented by `legdur.db` and output any differences. Only files that changed or got deleted get printed out, additions or file moves anywhere within the directory are not.
* it will move the current `legdur.db` to `legdur.old` and write the new state of the world to a new `legdur.db`
## Contact & contributions
M src/main.rs +12 -1
@@ 56,7 56,18 @@ fn compare_with_old(old_database_path: &
old_db
.into_par_iter()
.for_each(|(key, old_value)| match new_db.get(&key) {
- None => warn!("{key} does not exist anymore"),
+ None => {
+ // FIXME probably better to store reverse hash in db as well
+ // instead of searching every time
+ match new_db
+ .par_iter()
+ .find_any(|(_, new_value)| *new_value == &old_value)
+ {
+ Some(_) => { //file moved elsewhere but still exists
+ }
+ None => warn!("{key} does not exist anymore"),
+ }
+ }
Some(new_value) => {
if new_value != &old_value {
warn!("{key}: {old_value} -> {new_value}")