Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return null for unmergable heads rather than excepting #386

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1688,7 +1688,16 @@ protected SCMRevision retrieve(SCMHead head, TaskListener listener)
}
PullRequestSCMRevision prRev =
createPullRequestSCMRevision(pr, prhead, listener, ghRepository);
prRev.validateMergeHash();
try {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need to do this if the prHead is a merge, right?
Maybe encapsulate this in a method and call from the two different places we currently call validateMergeHash()?
getValidatedMergeOrNull()?

prRev.validateMergeHash();
} catch (AbortException e) {
listener
.getLogger()
.format(
"Resolved %s as unmergable pull request %d: %s.%n",
prhead.getName(), prhead.getNumber(), prRev.getPullHash());
return null;
}
return prRev;
} else if (head instanceof GitHubTagSCMHead) {
GitHubTagSCMHead tagHead = (GitHubTagSCMHead) head;
Expand Down