Skip to content

Commit

Permalink
Merge pull request #319 from jglick/SCMTrigger-JENKINS-26582
Browse files Browse the repository at this point in the history
[JENKINS-26582] notifyCommit should ignore projects without SCMTrigger

Passed tests on multiple platforms.
  • Loading branch information
MarkEWaite committed May 14, 2015
2 parents 6c1c49f + a1a9d1f commit b88b388
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/hudson/plugins/git/GitStatus.java
Expand Up @@ -238,8 +238,8 @@ public List<ResponseContributor> onNotifyCommit(URIish uri, String sha1, List<Pa
}

SCMTrigger trigger = scmTriggerItem.getSCMTrigger();
if (trigger != null && trigger.isIgnorePostCommitHooks()) {
LOGGER.info("PostCommitHooks are disabled on " + project.getFullDisplayName());
if (trigger == null || trigger.isIgnorePostCommitHooks()) {
LOGGER.info("no trigger, or post-commit hooks disabled, on " + project.getFullDisplayName());
continue;
}

Expand All @@ -266,7 +266,7 @@ public List<ResponseContributor> onNotifyCommit(URIish uri, String sha1, List<Pa
new CauseAction(new CommitHookCause(sha1)),
new RevisionParameterAction(sha1), new ParametersAction(buildParameters));
result.add(new ScheduledResponseContributor(project));
} else if (trigger != null) {
} else {
LOGGER.info("Triggering the polling of " + project.getFullDisplayName());
trigger.run();
result.add(new PollingScheduledResponseContributor(project));
Expand Down
3 changes: 3 additions & 0 deletions src/test/java/hudson/plugins/git/GitSCMTest.java
Expand Up @@ -33,6 +33,7 @@
import hudson.slaves.DumbSlave;
import hudson.slaves.EnvironmentVariablesNodeProperty.Entry;
import hudson.tools.ToolProperty;
import hudson.triggers.SCMTrigger;
import hudson.util.IOException2;
import hudson.util.StreamTaskListener;

Expand Down Expand Up @@ -1559,6 +1560,7 @@ public void testPolling_environmentValueAsEnvironmentContributingAction() throws
public void testCustomSCMName() throws Exception {
final String branchName = "master";
final FreeStyleProject project = setupProject(branchName, false);
project.addTrigger(new SCMTrigger(""));
GitSCM git = (GitSCM) project.getScm();
setupJGit(git);

Expand Down Expand Up @@ -1654,6 +1656,7 @@ private void checkNumberedBuildScmName(FreeStyleProject project, int buildNumber
public void testSha1NotificationBranches() throws Exception {
final String branchName = "master";
final FreeStyleProject project = setupProject(branchName, false);
project.addTrigger(new SCMTrigger(""));
final GitSCM git = (GitSCM) project.getScm();
setupJGit(git);

Expand Down

0 comments on commit b88b388

Please sign in to comment.