From 48dfd5dfa02c1caabaadb48d65817ba7034bdc0e Mon Sep 17 00:00:00 2001 From: TapTap Date: Sat, 5 Sep 2026 10:43:58 +0200 Subject: [PATCH] Fix incremental skip regression from modify-window nsec comparison metadata_mtime_matches() required exact nanosecond equality at the default modify_window=0, but destination write-time nsecs never match source creation-time nsecs unless -M preserves metadata. Compare whole seconds (rsync's default quick-check) at window 0; keep the subsecond-refined tolerance for explicit window values. --- src/shared/metadata.c | 2 ++ tests/test_metadata.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/metadata.c b/src/shared/metadata.c index d4a251e..80d50cb 100644 --- a/src/shared/metadata.c +++ b/src/shared/metadata.c @@ -43,6 +43,8 @@ bool metadata_mtime_matches(time_t left_sec, long left_nsec, time_t right_sec, l seconds--; nanoseconds += 1000000000LL; } + if (modify_window == 0) + return left == right; return seconds < modify_window || (seconds == modify_window && nanoseconds == 0); } diff --git a/tests/test_metadata.c b/tests/test_metadata.c index cf323f7..424d499 100644 --- a/tests/test_metadata.c +++ b/tests/test_metadata.c @@ -131,7 +131,7 @@ static void test_metadata_mtime_window() { EXPECT_FALSE(metadata_mtime_matches(100, 100000000, 102, 900000000, 2)); EXPECT_TRUE(metadata_mtime_matches(100, 900000000, 102, 900000000, 2)); EXPECT_FALSE(metadata_mtime_matches(100, 900000000, 101, 100000001, 0)); - EXPECT_FALSE(metadata_mtime_matches(100, 100000000, 100, 100000001, 0)); + EXPECT_TRUE(metadata_mtime_matches(100, 100000000, 100, 100000001, 0)); EXPECT_TRUE(metadata_mtime_matches(100, 100000000, 100, 100000000, 0)); }