Permalink
Browse files

[FIXED JENKINS-42236] Replicate the isMatch guard in heads

  • Loading branch information...
stephenc committed Feb 21, 2017
1 parent 16e366e commit 59a826435ff7c8dfbd4c6739842c5b06dbcd337d
Showing with 19 additions and 3 deletions.
  1. +19 −3 src/main/java/jenkins/plugins/git/GitSCMSource.java
@@ -341,9 +341,25 @@ public boolean isMatch(SCMSource source) {
@NonNull
@Override
public Map<SCMHead, SCMRevision> heads(@NonNull SCMSource source) {
SCMHead head = new SCMHead(branch);
return Collections.<SCMHead, SCMRevision>singletonMap(head,
sha1 != null ? new SCMRevisionImpl(head, sha1) : null);
if (source instanceof GitSCMSource) {
GitSCMSource git = (GitSCMSource) source;
if (git.ignoreOnPushNotifications) {
return Collections.emptyMap();
}
URIish remote;
try {
remote = new URIish(git.getRemote());
} catch (URISyntaxException e) {
// ignore
return Collections.emptyMap();
}
if (GitStatus.looselyMatches(u, remote)) {
SCMHead head = new SCMHead(branch);
return Collections.<SCMHead, SCMRevision>singletonMap(head,
sha1 != null ? new SCMRevisionImpl(head, sha1) : null);
}
}
return Collections.emptyMap();
}

@Override

0 comments on commit 59a8264

Please sign in to comment.