Sonar SCM history information captured from Stash / Bitbucket ( git ) when merged user different to original author

381 views
Skip to first unread message

matad...@googlemail.com

unread,
Oct 12, 2016, 9:05:25 AM10/12/16
to SonarQube
Team,

We use git through Stash / Bitbucket and noticed if someone authors a change and is included in the commit if another user performs the merge it's the merging user who appears as history for the change.  A merge user would appear to indicate they are merging from the authors fork to the target branch.  

Is this expected behaviour? Other tools e.g. git history view don't report the merge commits as part of the history however perhaps Sonar is parsing this?

Thanks

Matt

Julien HENRY

unread,
Oct 12, 2016, 11:23:09 AM10/12/16
to SonarQube, matad...@googlemail.com
Hi,

We are supposed to report original author since version 1.1 of the SonarQube Git plugin:

What is the version you are using? Note that in older versions of SonarQube (5.0 if I remember correctly) the Git plugin was built-in so not upgradable.

++

Julien

matad...@googlemail.com

unread,
Oct 12, 2016, 12:32:16 PM10/12/16
to SonarQube, matad...@googlemail.com
Thanks Julien

This is on SonarQube 5.6 LTS and Git plug in 1.2

Do you want me to enable further logging to help determine why we see the wrong person here in the history?

Julien HENRY

unread,
Oct 14, 2016, 5:28:44 AM10/14/16
to SonarQube, matad...@googlemail.com
Hi,

I don't think logging would help. Was the file recently modified? SCM data are not refreshed if file content is unchanged. So if you were previously using the old plugin and now using 1.2, don't expect SCM data to be updated.

The best way to investigate is to try to reproduce using JGit command line tool. See procedure here:

The org.eclipse.jgit.pgm-4.2.0.201601211800-r.sh blame -w <your file>
command should show the author on each line.

++

Julien

matad...@googlemail.com

unread,
Oct 18, 2016, 3:25:16 PM10/18/16
to SonarQube, matad...@googlemail.com
Julien and I actually followed up further. The issue here was simply that the jenkins job we performed full analysis on was using the shallow clone behaviour which meant not all history was available. This actually mentioned here


This maybe sufficient although we might want to update slightly as the shallow clone didn't cause any error just incorrect information. Perhaps we may want to add to a FAQ section e.g. "Issues aren't being assigned to the correct users" with one answer to check no shallow clone is performed

Julien HENRY

unread,
Oct 19, 2016, 4:06:11 AM10/19/16
to SonarQube, matad...@googlemail.com
Hi,

I have slightly updated the Git plugin documentation to report the case where doing blame on a shallow clone don't fail but produce wrong data.

I also created a ticket since this is not the first time shallow clone are causing issue: https://jira.sonarsource.com/browse/SONARSCGIT-13

++

Julien

Christi...@icloud.com

unread,
Nov 14, 2016, 8:32:06 AM11/14/16
to SonarQube, matad...@googlemail.com
Hi Julien,

any plans when this will be fixed?

Thanks,
Christian

Julien HENRY

unread,
Nov 15, 2016, 4:19:28 AM11/15/16
to SonarQube, matad...@googlemail.com, Christi...@icloud.com
Hi Christian,

I created a ticket to fail fast when we detect a shallow clone. There is nothing we can do to *fix* the issue. Shallow clone = no blame possible.

++

Julien
Reply all
Reply to author
Forward
0 new messages