From 1ebe261e05812c34770da4c49cd29664bd893a7e Mon Sep 17 00:00:00 2001 From: TapTap Date: Thu, 3 Sep 2026 21:49:10 +0200 Subject: [PATCH] fix: complete ignore-times incremental handling --- src/shared/config.h | 2 +- src/shared/file_receive.c | 3 ++- tests/integration/test_features.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/shared/config.h b/src/shared/config.h index 64e4afa..44fbe6d 100644 --- a/src/shared/config.h +++ b/src/shared/config.h @@ -129,7 +129,7 @@ typedef struct Config { char* compress_choice; } Config; -#define PROTOCOL_VERSION "2.2.0" +#define PROTOCOL_VERSION "2.3.0" #define DEFAULT_CHUNK_SIZE (10 * 1024 * 1024) Config* config_create(void); diff --git a/src/shared/file_receive.c b/src/shared/file_receive.c index a610d67..e1e1882 100644 --- a/src/shared/file_receive.c +++ b/src/shared/file_receive.c @@ -375,7 +375,8 @@ File* receive_incremental_check(int fd, const Config* config, bool* skipped) { close(old_fd); } - bool match = has_old_file && (unsigned long long)st.st_size == check_size; + bool match = + !config->ignore_times && has_old_file && (unsigned long long)st.st_size == check_size; if (match && config->checksum) { uint64_t old_checksum = old_size == 0 ? delta_xxhash64("", 0) : 0; if (old_data) diff --git a/tests/integration/test_features.py b/tests/integration/test_features.py index dac6549..11ccb30 100644 --- a/tests/integration/test_features.py +++ b/tests/integration/test_features.py @@ -223,7 +223,7 @@ class TestIncremental: received_file = os.path.join(received, "small.txt") source_stat = os.stat(source_file) with open(received_file, "wb") as f: - f.write(b"stale data\n") + f.write(b"stale data!\n") os.utime(received_file, (source_stat.st_atime, source_stat.st_mtime)) result, _ = run_client(SOURCE_DIR, DEST_DIR,