Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ annotate vs git blame

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

like image 783
EhmKah a.k.a. Michael Krauße Avatar asked Jan 16 '16 09:01

EhmKah a.k.a. Michael Krauße


People also ask

What is Annotate with Git blame IntelliJ?

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.

What is Annotate in IntelliJ?

Annotations Last modified: 17 March 2022. Java annotations are pieces of metadata that provide information about the code they are used with, and can instruct the IDE how to process this code. In Java, there is a set of built-in annotations.

What is Git blame used for?

The git blame command is used to examine the contents of a file line by line and see when each line was last modified and who the author of the modifications was.


2 Answers

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.

like image 110
yole Avatar answered Sep 30 '22 17:09

yole


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.

like image 39
yeahwhat Avatar answered Sep 30 '22 17:09

yeahwhat