diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2019-04-01 11:28:19 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2019-04-23 20:21:07 +0200 |
commit | 81638702d68033ca95ddd406aa655fb2bfdab036 (patch) | |
tree | 517407d64df2d9cb95ed27a32aab3c82b8f58092 /sonar-scanner-engine/src/main/java/org/sonar/scanner/report | |
parent | afe312e4cbf9ac88676d526ff6da0b641aef4ae8 (diff) | |
download | sonarqube-81638702d68033ca95ddd406aa655fb2bfdab036.tar.gz sonarqube-81638702d68033ca95ddd406aa655fb2bfdab036.zip |
SONAR-11856 Store the "true" target branch in the scanner report to display it properly
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/report')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java | 6 | ||||
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java index 8bc978109b6..ff393c42773 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/ChangedLinesPublisher.java @@ -57,8 +57,8 @@ public class ChangedLinesPublisher implements ReportPublisherStep { @Override public void publish(ScannerReportWriter writer) { - String targetScmBranch = branchConfiguration.targetScmBranch(); - if (scmConfiguration.isDisabled() || !branchConfiguration.isShortOrPullRequest() || targetScmBranch == null) { + String targetBranchName = branchConfiguration.targetBranchName(); + if (scmConfiguration.isDisabled() || !branchConfiguration.isShortOrPullRequest() || targetBranchName == null) { return; } @@ -68,7 +68,7 @@ public class ChangedLinesPublisher implements ReportPublisherStep { } Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG); - int count = writeChangedLines(provider, writer, targetScmBranch); + int count = writeChangedLines(provider, writer, targetBranchName); LOG.debug("SCM reported changed lines for {} {} in the branch", count, ScannerUtils.pluralize("file", count)); profiler.stopInfo(); } diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java index 69891747295..9bf40f4a94e 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/report/MetadataPublisher.java @@ -160,6 +160,10 @@ public class MetadataPublisher implements ReportPublisherStep { if (referenceBranch != null) { builder.setMergeBranchName(referenceBranch); } + String targetBranchName = branchConfiguration.targetBranchName(); + if (targetBranchName != null) { + builder.setTargetBranchName(targetBranchName); + } if (branchType == BranchType.PULL_REQUEST) { builder.setPullRequestKey(branchConfiguration.pullRequestKey()); } |