}
}
+/**
+ * @brief Update the paths of the diff items recursively.
+ * @param[in] nDirs Number of directories to compare.
+ * @param[in,out] di\81@Item to update the path.
+ */
+void UpdatePaths(int nDirs, DIFFITEM& di)
+{
+ assert(nDirs == 2 || nDirs == 3);
+
+ if (di.HasChildren())
+ {
+ for (DIFFITEM* pdic = di.GetFirstChild(); pdic; pdic = pdic->GetFwdSiblingLink())
+ {
+ for (int i = 0; i < nDirs; i++)
+ pdic->diffFileInfo[i].path = paths::ConcatPath(di.diffFileInfo[i].path, di.diffFileInfo[i].filename);
+ UpdatePaths(nDirs, *pdic);
+ }
+ }
+}
+
void SetDiffCounts(DIFFITEM& di, unsigned diffs, unsigned ignored)
{
di.nidiffs = ignored; // see StoreDiffResult() in DirScan.cpp
void CopyDiffSideAndProperties(DIFFITEM& di, int src, int dst);
void UnsetDiffSide(DIFFITEM& di, int index);
void UpdateStatusFromDisk(CDiffContext& ctxt, DIFFITEM& di, int index);
+void UpdatePaths(int nDirs, DIFFITEM& di);
void SetDiffCounts(DIFFITEM& di, unsigned diffs, unsigned ignored);
void SetItemViewFlag(DIFFITEM& di, unsigned flag, unsigned mask);
void SetItemViewFlag(CDiffContext& ctxt, unsigned flag, unsigned mask);
unsigned sideFlags = (di.diffcode.diffcode & DIFFCODE::SIDEFLAGS);
*pResult = DoItemRename(it, GetDiffContext(), String(sText));
// Rescan the item if side flags change due to renaming.
- if (*pResult && ((di.diffcode.diffcode & DIFFCODE::SIDEFLAGS) != sideFlags))
+ if (*pResult)
{
- // Delete the item with the same file name as after renaming.
- if (di.HasParent())
+ if ((di.diffcode.diffcode & DIFFCODE::SIDEFLAGS) != sideFlags)
{
- for (DIFFITEM* pItem = di.GetParentLink()->GetFirstChild(); pItem != nullptr; pItem = pItem->GetFwdSiblingLink())
+ // Delete the item with the same file name as after renaming.
+ if (di.HasParent())
{
- if ((pItem != &di) && (pItem->diffcode.isDirectory() == di.diffcode.isDirectory()) && (collstr(pItem->diffFileInfo[0].filename, di.diffFileInfo[0].filename, false) == 0))
+ for (DIFFITEM* pItem = di.GetParentLink()->GetFirstChild(); pItem != nullptr; pItem = pItem->GetFwdSiblingLink())
{
- pItem->DelinkFromSiblings();
- delete pItem;
- break;
+ if ((pItem != &di) && (pItem->diffcode.isDirectory() == di.diffcode.isDirectory()) && (collstr(pItem->diffFileInfo[0].filename, di.diffFileInfo[0].filename, false) == 0))
+ {
+ pItem->DelinkFromSiblings();
+ delete pItem;
+ break;
+ }
}
}
+ // Rescan the item.
+ MarkForRescan(di);
+ m_pSavedTreeState.reset(SaveTreeState(GetDiffContext()));
+ GetDocument()->SetMarkedRescan();
+ GetDocument()->Rescan();
+ }
+ else {
+ int nDirs = GetDiffContext().GetCompareDirs();
+ assert(nDirs == 2 || nDirs == 3);
+ UpdatePaths(nDirs, di);
+
+ int nIdx = reinterpret_cast<NMLVDISPINFO*>(pNMHDR)->item.iItem;
+ UpdateDiffItemStatus(nIdx);
}
- // Rescan the item.
- MarkForRescan(di);
- m_pSavedTreeState.reset(SaveTreeState(GetDiffContext()));
- GetDocument()->SetMarkedRescan();
- GetDocument()->Rescan();
}
} catch (ContentsChangedException& e) {
AfxMessageBox(e.m_msg.c_str(), MB_ICONWARNING);