Skip to content

Commit 30b0e98

Browse files
committed
Revert minor code cleanup to highlight only merge_commit_sha change
1 parent 6b8a840 commit 30b0e98

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

src/main/java/org/jenkinsci/plugins/github_branch_source/GitHubSCMSource.java

+11-12
Original file line numberDiff line numberDiff line change
@@ -982,22 +982,21 @@ public SCMSourceCriteria.Probe create(@NonNull PullRequestSCMHead head,
982982
public SCMRevision create(@NonNull PullRequestSCMHead head,
983983
@Nullable Void ignored)
984984
throws IOException, InterruptedException {
985-
String baseHash = pr.getBase().getSha();
986-
String mergeHash = null;
987-
988985
switch (strategy) {
989986
case MERGE:
990987
request.checkApiRateLimit();
991-
baseHash = ghRepository.getRef("heads/" + head.getTarget().getName()).getObject().getSha();
992-
mergeHash = pr.getMergeCommitSha();
993-
break;
994-
default:
995-
break;
988+
GHRef mergeRef = ghRepository.getRef(
989+
"heads/" + pr.getBase().getRef()
990+
);
991+
return new PullRequestSCMRevision(head,
992+
mergeRef.getObject().getSha(),
993+
pr.getHead().getSha(),
994+
pr.getMergeCommitSha());
995+
default:
996+
return new PullRequestSCMRevision(head, pr.getBase().getSha(),
997+
pr.getHead().getSha(),
998+
null);
996999
}
997-
return new PullRequestSCMRevision(head,
998-
baseHash,
999-
pr.getHead().getSha(),
1000-
mergeHash);
10011000
}
10021001
},
10031002
new MergabilityWitness(pr, strategy, listener),

0 commit comments

Comments
 (0)