Whole files considered new code in short-lived branch

sonarqube

(Julien Henry) #27

Thanks for confirming the issue is related to core.autocrlf on Windows. To avoid this issue, I think we should use (or emulate) the -w option of git diff to ignore any whitespace change when considering line changes (which are most of the time not taking any role in issues).
It would also be more consistent with the blame.

I created a ticket:
https://jira.sonarsource.com/browse/SONARSCGIT-41


(Petermbauer) #28

I set the respective config option in the .gitattributes file in the repo itself. Maybe the Git plugin does not read this file or the settings on the host have priority?

# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

(Julien Henry) #29

It is maybe a limitation of JGit, but we will dig more into it when tackling the ticket I created. In the meantime you’ll have to configure your CI boxes to not alter line ends when checking out the code.


(Javier Azaret) #31

@Julien_HENRY @Andreas_Petersen I have the same issue on Windows and the fix ended up being setting git config --global core.autocrlf true for me.


(Javier Azaret) #32

@Julien_HENRY This ticket may be related as jGit should be reading properties from .gitattributes file on the repo.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=545701


(Julien Henry) #33

I don’t think this ticket is related (it talk about the archive command that works remotely). But still I found several other tickets talking about limited support for some attributes in .gitattributes. Again we will dig into it when talking the ticket I created.