From 9720d75a61370ee915fec6db5b99ef1f4cae010a Mon Sep 17 00:00:00 2001 From: ducklet Date: Tue, 21 Feb 2023 21:32:48 +0100 Subject: [PATCH] fix change check for dirs We recalculate the stored dir size for every dir to be the sum of all ancestors, so comparing the dir size as reported by the file system will usually always differ. --- metadex/db.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadex/db.py b/metadex/db.py index 5f5836b..e45e8af 100644 --- a/metadex/db.py +++ b/metadex/db.py @@ -408,7 +408,8 @@ def upsert_if_changed( assert isinstance(row, Row) # Required for Mypy 1.0.0. is_changed = ( - new_data["stat_bytes"] != row.stat_bytes + # For dirs we ignore the reported size, because we're not storing it as-is. + (new_data["stat_type"] != "d" and new_data["stat_bytes"] != row.stat_bytes) # or new_data["stat_changed"] != row.stat_changed # Ignore ctime, mtime is enough or new_data["stat_modified"] != row.stat_modified or new_data["stat_type"] != row.stat_type