aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce-task-projectanalysis
diff options
context:
space:
mode:
authorantoine.vinot <antoine.vinot@sonarsource.com>2024-12-12 09:11:16 +0100
committerSteve Marion <steve.marion@sonarsource.com>2024-12-18 11:13:23 +0100
commit612c2814ec30a36437a6fe98215223a0eb45ac1c (patch)
tree2680b86600b2d4ed636f152fce31d09c90e7796a /server/sonar-ce-task-projectanalysis
parentdb70e0ef0445d40c5449f8747f261dddbb24eaba (diff)
downloadsonarqube-612c2814ec30a36437a6fe98215223a0eb45ac1c.tar.gz
sonarqube-612c2814ec30a36437a6fe98215223a0eb45ac1c.zip
SONAR-22265 Fix trying to get referenceBranch for main branch
Diffstat (limited to 'server/sonar-ce-task-projectanalysis')
-rw-r--r--server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/OriginalFileResolver.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/OriginalFileResolver.java b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/OriginalFileResolver.java
index 8cda1cfaf52..094bcec3f79 100644
--- a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/OriginalFileResolver.java
+++ b/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/source/OriginalFileResolver.java
@@ -70,9 +70,11 @@ public class OriginalFileResolver {
}
- String componentUuidFromReferenceBranch = referenceBranchComponentUuids.getComponentUuid(file.getKey());
- if (componentUuidFromReferenceBranch != null) {
- return Optional.of(componentUuidFromReferenceBranch);
+ if (!analysisMetadataHolder.getBranch().isMain()) {
+ String componentUuidFromReferenceBranch = referenceBranchComponentUuids.getComponentUuid(file.getKey());
+ if (componentUuidFromReferenceBranch != null) {
+ return Optional.of(componentUuidFromReferenceBranch);
+ }
}
}