MCPcopy Create free account
hub / github.com/KDE/kdiff3 / fastFileComparison

Method fastFileComparison

src/MergeFileInfos.cpp:379–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

377}
378
379bool MergeFileInfos::fastFileComparison(
380 FileAccess& fi1, FileAccess& fi2,
381 bool& bError, QString& status)
382{
383 ProgressScope pp;
384 bool bEqual = false;
385
386 status = "";
387 bError = true;
388
389 qCDebug(kdiffMergeFileInfo) << "Entering MergeFileInfos::fastFileComparison";
390 if(fi1.isNormal() != fi2.isNormal())
391 {
392 qCDebug(kdiffMergeFileInfo) << "Have: \'" << fi2.fileName() << "\' , isNormal = " << fi2.isNormal();
393
394 status = i18n("Unable to compare non-normal file with normal file.");
395 return false;
396 }
397
398 if(!fi1.isNormal())
399 {
400 qCInfo(kdiffMergeFileInfo) << "Skipping not a normal file.";
401 bError = false;
402 return false;
403 }
404
405 if(!gOptions->m_bDmFollowFileLinks)
406 {
407 qCInfo(kdiffMergeFileInfo) << "Have: \'" << fi2.fileName() << "\' , isSymLink = " << fi2.isSymLink();
408 /*
409 "git difftool --dir-diff"
410 sets up directory comparsions with symlinks to the current work tree being compared with real files.
411
412 m_bAllowMismatch is a compatibility work around.
413 */
414 if(fi1.isSymLink() != fi2.isSymLink())
415 {
416 qCDebug(kdiffMergeFileInfo) << "Rejecting comparison of link to file. With the same relitive path.";
417 status = i18n("Mix of links and normal files.");
418 return bEqual;
419 }
420 else if(fi1.isSymLink() && fi2.isSymLink())
421 {
422 qCDebug(kdiffMergeFileInfo) << "Comparison of link to link. OK.";
423 bError = false;
424 bEqual = fi1.readLink() == fi2.readLink();
425 status = i18n("Link: ");
426 return bEqual;
427 }
428 }
429
430 if(fi1.size() != fi2.size())
431 {
432 qCInfo(kdiffMergeFileInfo) << "Sizes differ.";
433 bError = false;
434 bEqual = false;
435 status = i18n("Size. ");
436 return bEqual;

Callers

nothing calls this directly

Calls 7

isNormalMethod · 0.80
fileNameMethod · 0.80
openMethod · 0.80
closeMethod · 0.80
isSymLinkMethod · 0.45
sizeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected