in src/main/java/org/apache/jenkins/gitpubsub/GitPubSubPoll.java [335:361]
public Map<SCMHead, SCMRevision> heads(@NonNull SCMSource source) {
if (source instanceof GitSCMSource) {
GitSCMSource git = (GitSCMSource) source;
if (SCMTrait.find(git.getTraits(), IgnoreOnPushNotificationTrait.class) != null || remoteUri == null) {
return Collections.emptyMap();
}
URIish remoteUri;
try {
remoteUri = new URIish(git.getRemote());
} catch (URISyntaxException e) {
return Collections.emptyMap();
}
if (GitStatus.looselyMatches(this.remoteUri, remoteUri)) {
String ref = getPayload().get("ref").asText();
SCMHead head = new SCMHead(ref.substring(Constants.R_HEADS.length()));
String sha1 = getPayload().get("to").textValue();
return Collections.<SCMHead, SCMRevision>singletonMap(
head,
sha1 != null
? new AbstractGitSCMSource.SCMRevisionImpl(head, sha1)
: null
);
}
}
return Collections.emptyMap();
}