Ahmad Albatsh
Ahmad Albatsh

Reputation: 434

Clicking "Annotate" in intellij gives warning "number of lines annotated by git is not equal to number of lines"

When I try to see the side menu upon clicking "show annotate" this message appears only on this file. Other than that annotations work for all other files.

number of lines annotated by git is not equal to number of lines in the file. Check file encoding and line separators

This problem occurs in Intellij. And in my case in Android Studio

Upvotes: 7

Views: 4209

Answers (7)

Mattias Inokuchi
Mattias Inokuchi

Reputation: 261

I fixed this problem by changing line separator for the file from CR to LF in the bottom list of the IDE (PHPStorm).

Upvotes: 0

Jianwu Chen
Jianwu Chen

Reputation: 6023

Got the same issue recently. My solution is to restart the IDE.

Upvotes: 0

Andrey
Andrey

Reputation: 83

I had the same issue on PyCharm (Pro 2023.1.2), and running File -> Repair IDE did the trick.
The IDE will try a couple of things and will prompt you to check if things work on the bottom right corner. For me the issue was the indexing, so it did its thing, and after a restart everything was working again.

Upvotes: 6

Krishna Kishore Annam
Krishna Kishore Annam

Reputation: 61

faced this issue in GoLand (sibling of IntelliJ)
and, when opened the same project in VSCode, its working fine.

This gave a hint, that something is wrong in .idea folder,
removed the .idea folder and opened the project again in GoLand,
It Worked & annotation works well

Thanks

Upvotes: 0

Aviator
Aviator

Reputation: 107

Was seeing this issue in both intelliJ and PyCharm at the same time for the same file. I did not check if the issue persisted with any other file (perhaps should have).

Though that putting the IDE in power save mode may have done it but removing from power save mode did not work. Restarting the IDE by invalidating cache did not help either.

Then I realized that I had put that particular file to be assumed as unchanged by running git update-index --assume-unchanged <filename>

Once I undid that by running git update-index --no-assume-unchanged <filename>, the warning went away - and the IDE showed all of the lines properly annotated again.

HTH

Upvotes: 0

Glebsa
Glebsa

Reputation: 512

WSL2, Windows 11, Goland GoLand 2022.1.2. Same problem. IDE restart didn't help, what helped is to restart the WSL2 env:

wsl --shutdown ubuntu

Before restart you should close the IDE.

Upvotes: 3

pszaba
pszaba

Reputation: 1064

I know it isn't the solution but I wasn't able find out the root of the problem but I share what I did to get it working.

This happened to me after I hibernated my win 11 (WSL2 and docker) and the next day I tried to work.

After I restarted phpStorm it said, git was not even installed.

I did

  • git reset hard and clean,
  • reopened the project inside phpStorm, (after this it was still broken)
  • restarted the computer

after all of this it started to work again.

Upvotes: 0

Related Questions