Skip to content

Commit ce60cad

Browse files
authored
Fix the problem that the comparison result is not displayed correctly when renaming a file (directory) that exists on only one side to a name where the directory (file) with the same name exists. (#1246)
- Change to judge that a directory or file exists only if the type (directory or file) of renamed item matches the original diffItem type in the diffItem update process.
1 parent 268b3ce commit ce60cad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Src/DirActions.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,15 @@ bool DoItemRename(InputIterator& it, const CDiffContext& ctxt, const String& szN
559559
for (int index = 0; index < nDirs; index++)
560560
{
561561
di.diffFileInfo[index].filename = szNewItemName;
562-
if (bRename[index] || paths::DoesPathExist(GetItemFileName(ctxt, di, index)))
562+
bool bSetSideFlag = bRename[index];
563+
if (!bSetSideFlag)
564+
{
565+
paths::PATH_EXISTENCE pathExist = paths::DoesPathExist(GetItemFileName(ctxt, di, index));
566+
bool bIsDirectory = di.diffcode.isDirectory();
567+
if (((pathExist == paths::IS_EXISTING_DIR) && bIsDirectory) || ((pathExist == paths::IS_EXISTING_FILE) && !bIsDirectory))
568+
bSetSideFlag = true;
569+
}
570+
if (bSetSideFlag)
563571
di.diffcode.setSideFlag(index);
564572
}
565573
return true;

0 commit comments

Comments
 (0)