16

I am using IntelliJ's annotate feature to see in the editor who last changed a line in a file.

Now I am using JGit to read the same annotations and they differ. For me it seems that Intellij checks that a line has not been changed between commits and still uses the old commit message. JGit does not see it and so makes an other message.

Can anybody confirm that the behavior of JGit blame and IntelliJ differs? Whats the reason and how can I force IntelliJ to behave the same like JGit? Maybe IntelliJ ignores whitespace changes?

I am using IntelliJ 15.0.1 and JGit 4.1.1

  • 11
    For the googlers landing here searching for the function i nIntelliJ: it's right click in the editor -> git -> Annotate – koppor Aug 19 '16 at 04:47
  • linked https://stackoverflow.com/questions/49402935/improve-intellij-annotate-git-blame – TT-- Aug 16 '18 at 18:17

3 Answers3

22

IntelliJ IDEA does not have its own algorithm for calculating annotations; it simply runs the standard git blame command and parses its output. There is no way to force it to behave differently.

You can find the code implementing the Annotate command in the IntelliJ IDEA Git plugin here.

yole
  • 92,896
  • 20
  • 260
  • 197
18

You were right, the source linked in yole's answer shows that the plugin is calling git blame with the -w option, which ignores whitespace differences. This behavior doesn't seem to be modifiable.

yeahwhat
  • 775
  • 4
  • 13
2

IntelliJ ignores whitespace by default. You can change this in the context menu of the annotations (right-click on an annotation): enter image description here

Ulli
  • 2,107
  • 1
  • 12
  • 10