From 7d389f8e0c846b8bd808fa5013253f1db0199b5c Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Fri, 28 Feb 2025 17:39:06 +0100 Subject: [PATCH] Handle corner case in conflict check --- src/sync-manager.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/sync-manager.ts b/src/sync-manager.ts index e21309b..8697fc9 100644 --- a/src/sync-manager.ts +++ b/src/sync-manager.ts @@ -446,10 +446,17 @@ export default class SyncManager { remoteFile.sha !== localFile.sha; const localFileHasBeenModifiedSinceLastSync = actualLocalSHA !== localFile.sha; - + // This is an unlikely case. If the user manually edits + // the local file so that's identical to the remote one, + // but the local metadata SHA is different we don't want + // to show a conflict. + // Since that would show two identical files. + // Checking for this prevents showing a non conflict to the user. + const actualFilesAreDifferent = remoteFile.sha !== actualLocalSHA; if ( remoteFileHasBeenModifiedSinceLastSync && - localFileHasBeenModifiedSinceLastSync + localFileHasBeenModifiedSinceLastSync && + actualFilesAreDifferent ) { return filePath; }