From ee1faee4db0752437314c9171d96d4cca6fe8a04 Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Sun, 27 Jan 2019 00:27:39 +0900 Subject: [PATCH] Fix bitbucket issue #138: Unique files are not shown When comparing empty file and nonexistent file, `DIFFCODE::SAME` flag is set to the variable `code`, so change the flag to `DIFFCODE::DIFF` --- Src/FolderCmp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Src/FolderCmp.cpp b/Src/FolderCmp.cpp index cb8ca15f6..c995bd173 100644 --- a/Src/FolderCmp.cpp +++ b/Src/FolderCmp.cpp @@ -437,9 +437,9 @@ exitPrepAndCompare: if (nDirs > 2 && filepathUnpacked[2] != tFiles[2]) try { TFile(filepathUnpacked[2]).remove(); } catch (...) { LogErrorString(strutils::format(_T("DeleteFile(%s) failed"), filepathUnpacked[2].c_str())); } - if (!pCtxt->m_bIgnoreCodepage && - (code & DIFFCODE::COMPAREFLAGS) == DIFFCODE::SAME && - !std::equal(encoding + 1, encoding + nDirs, encoding)) + // When comparing empty file and nonexistent file, `DIFFCODE::SAME` flag is set to the variable `code`, so change the flag to `DIFFCODE::DIFF` + // Also when disabling ignore codepage option and the encodings of files are not equal, change the flag to `DIFFCODE::DIFF even if `DIFFCODE::SAME` flag is set to the variable `code` + if (!di.diffcode.existAll() || (!pCtxt->m_bIgnoreCodepage && !std::equal(encoding + 1, encoding + nDirs, encoding))) code = (code & ~DIFFCODE::COMPAREFLAGS) | DIFFCODE::DIFF; } else if (nCompMethod == CMP_BINARY_CONTENT) -- 2.11.0