Home > database >  IntelliJ Show Diff Includes Unversioned Files
IntelliJ Show Diff Includes Unversioned Files

Time:10-02

After upgrading to IntelliJ IDEA 2021.2.2 Ultimate Edition, I've noticed now that when I go to the Commit pane and select Show Diff on a file in the Default Changelist, that it includes the Unversioned Files in the set of files for the diff comparison.

That is, say I only change one line of code in pom.xml but I also have some un-versioned file, let's say called temp.sql. If I open the Show Diff tool by select Show Diff from pom.xml in the Default Changelist, then the Compare to Next File button is still enabled. Clicking it takes me to temp.sql`, though I have no desire to look at it since I don't even have it in source control.

For example, here I have a Default Changelist with a change to one file in source control, pom.xml. And I have an un-versioned file called temp.sql. commit pane

When I select Show Diff on a file in the Default Changlist, it should, in my opinion, and in my previous version of IntelliJ, only show you...the Default Changelist, which is pom.xml. Instead it is giving me pom.xml and temp.sql. diff window

Is this a new feature? It seems like a bug to me. I can't seem to find any documentation for it. I can't find any way to turn it off.

I see there is a "Show unversioned files" check box in the Version Control > Commit section of Preferences, but clicking it doesn't seem to change anything. version control commit preferences

CodePudding user response:

  1. If I choose Show Diff on the Default Changelist object, rather than on a file in the Default Changelist, that it restricts navigation to the files in the change list as I want. It's only if I select Show Diff from a file in the Default Changelist that includes all files in all change lists, including un-versioned files.
  2. Ruslan Kuleshov made a comment that this seems like a known issue, https://youtrack.jetbrains.com/issue/IDEA-237528.

New commit tool: don't jump to other changelist's changes

I always review all changes on the current changelist before commit. I focus the diff preview and use F7 to jump through all changes on all files. Previously, when I reached the last file F7 stopped jumping to other files. But after enabling the new tool, when I press F7 on the last changed file on the current changelist, it jumps to the first change on the next changelist. That's a problem since I can begin reviewing changes which are not intended for commiting right now, loosing time, confusing me and even risking to mix files from different changesets.

I had failed to find that issue on https://youtrack.jetbrains.com because I hadn't yet tried having files in source control with changes in a non-default change list. I was only searching YouTrack for the fact that Show Diff now includes un-versioned files.

So, it seems that if you choose Show Diff from a file in a change list, then the diff comparison tool will now include all files in the set of files, regardless which change list they are in and regardless whether they are in source control yet.

I think that this is a bug and have voted for the issue. I encourage others to do so as well.

  • Related