Bug 434778 - git difftool --dir-diff causes "Mix of links and normal files error".
Summary: git difftool --dir-diff causes "Mix of links and normal files error".
Status: RESOLVED FIXED
Alias: None
Product: kdiff3
Classification: Applications
Component: application (show other bugs)
Version: 1.8.5
Platform: Homebrew (macOS) macOS
: NOR normal
Target Milestone: ---
Assignee: michael
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-22 17:34 UTC by DmA
Modified: 2021-04-26 03:14 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 1.9
Sentry Crash Report:


Attachments
modal dialog (47.97 KB, image/jpeg)
2021-03-22 17:34 UTC, DmA
Details
shows the black squares, resizing, and "Error: Conflicting File Types" (717.45 KB, image/png)
2021-03-22 17:35 UTC, DmA
Details

Note You need to log in before you can comment on or make changes to this bug.
Description DmA 2021-03-22 17:34:16 UTC
Created attachment 136949 [details]
modal dialog

SUMMARY
This is the same issue as I posted at https://stackoverflow.com/questions/66541006/kdiff3-giving-error-on-git-difftool-dir-diff

STEPS TO REPRODUCE
1. brew install kdiff3
2. setup as git difftool per https://docs.kde.org/trunk5/en/extragear-utils/kdiff3/git.html
3. git difftool --dir-diff
4. On an older version of kdiff3 I didn't get this

OBSERVED RESULT
I just upgraded kdiff3 on my mac (using brew). Since I did that, everytime I run git difftool --dir-diff branch <branch2> I get a modal dialog box that has the title "Some files could not be processed." and has a text area with zero or more "Mix of links and normal files.".

If I omit the --dir-diff it works as expected.

I'm not sure what this means. There are no symlinks in the directory (at least, find . -type l comes up empty). Maybe I'm doing something dumb, but I don't know what it's trying to complain about.

I can click ok, and move forward, and I get the actual diff, with two hiccups (no idea if the hiccups are related or not). For each of the files (but not directories)

1. in the "Operation" column I get "Error: Conflicting File Types".
2. in the "A" and "B" columns every square is black.

[This](https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg1678206.html) looked similar, but is not, I tried the test case and it doesn't even bring up the error for me.

I can't follow this, maybe it's the issue I'm having, it certainly has a lot of the same symptoms. But the only response I see is a request for a test case.

So:

    Does anyone know what this error even means?
    Does anyone know how to get rid of it? The fact that it breaks my concentration is a much bigger problem than clicking the single button.

Thank you very much.


EXPECTED RESULT
I wouldn't get the modal dialog, "Error: Conflicting File Types", or black squares.

SOFTWARE/OS VERSIONS
macOS: 10.15.7

ADDITIONAL INFORMATION
Also, I'm not sure if this is related, but there's a graphics issue where I only see the top line and a half of the diff until I resize the window.  Moving dividers w/in the window does not help.

I'm willing to believe that I'm doing something wrong, but I can't tell what.
Comment 1 DmA 2021-03-22 17:35:09 UTC
Created attachment 136950 [details]
shows the black squares, resizing, and "Error: Conflicting File Types"
Comment 2 michael 2021-03-29 21:36:12 UTC
What's happening here is that kdiff3 1.8 is more careful about what it does when an error occurs. In particular unless the preferences are set to resolve links trying to compare one to a file will give the above results. Older versions sometimes charged through without reporting anything. In investigating this I also found out that links are not being resolved in all cases even when kdiff3 has been told to do so. That shouldn't be the case.
Comment 3 michael 2021-04-05 15:33:48 UTC
The relevant code appears to be hear

if(!pOptions->m_bDmFollowFileLinks)
    {
        if(fi1.isSymLink() != fi2.isSymLink())
        {
            qCDebug(kdiffMain) << "Rejecting comparison of link to file.";
            status = i18n("Mix of links and normal files.");
            return bEqual;
        }
        else if(fi1.isSymLink() && fi2.isSymLink())
        {
            qCDebug(kdiffMain) << "Rejecting comparison of link to link. OK.";
            bError = false;
            bEqual = fi1.readLink() == fi2.readLink();
            status = i18n("Link: ");
            return bEqual;
        }
    }

This is inside MergeFileInfos::fastFileComparison which is only called when Full Analysis is turned on. I'm going to be adding an option to disable this message which was not passed on to the caller before 1.8.
This situation is created by git which internally symlinks the files in the current worktree and compares them to real files from the previous commit.
Comment 4 DmA 2021-04-05 16:04:03 UTC
git is doing something weird?  No!  Say it ain't so...

Thank you for looking into this and doing something about it.
Comment 5 michael 2021-04-05 18:03:43 UTC
It looks like turning on "Follow File Links" should be enough to prevent to message from showing. It also will not show if "Full Analysis" is turned on. What will still happen is the "Operation" column in the resulting comparison tree will show "Error: Conflicting File Types". Which it probably shouldn't in this case. Can you verify this on your end?
Comment 6 DmA 2021-04-06 16:52:14 UTC
Yes, that does it.  Thank you.

Then I'd guess this just devolves to a documentation bug?  I don't know if kdiff3 can tell that it's being called by git and do that automatically?  Other?

To be clear, at this point, I'm set.  I'm just hoping that other people won't get lost looking for this as well.

Thank you very much.
Comment 7 michael 2021-04-09 21:13:53 UTC
I don't think it would be easy to see a git induced launch from kdiff3's perspective there is no easy way to know who launched us. I can switch the default setting to enable link resolution since this is a common use case.
Comment 8 michael 2021-04-26 02:13:11 UTC
The default will be switched as of 1.9. The documentation update will be done in the next release
Comment 9 michael 2021-04-26 03:14:05 UTC
Git commit 4c4878188c604941491b354a1df2f5c7b747ac26 by Michael Reeves.
Committed on 26/04/2021 at 03:13.
Pushed by mreeves into branch 'master'.

Add FAQ for common git difftool issue
FIXED-IN:1.9

M  +9    -2    doc/en/index.docbook

https://invent.kde.org/sdk/kdiff3/commit/4c4878188c604941491b354a1df2f5c7b747ac26