Skip to content
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
35 changes: 33 additions & 2 deletions src/main/java/hudson/plugins/git/GitStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@
*/
@Override
public List<ResponseContributor> onNotifyCommit(String origin, URIish uri, String sha1, List<ParameterValue> buildParameters, String... branches) {
long startMs = System.currentTimeMillis();
sha1 = cleanupSha1(sha1);
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Received notification from {0} for uri = {1} ; sha1 = {2} ; branches = {3}",
Expand Down Expand Up @@ -397,14 +398,30 @@
branchMatches = false;
URIish matchedURL = null;
for (URIish remoteURL : repository.getURIs()) {
if (LOGGER.isLoggable(Level.FINEST)) {

Check warning on line 401 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 401 is only partially covered, one branch is missing
LOGGER.log(Level.FINEST, "Comparing notified uri {0} against repository uri {1} in project {2}", new Object[]{uri, remoteURL, project.getFullDisplayName()});

Check warning on line 402 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 402 is not covered by tests
}
if (looselyMatches(uri, remoteURL)) {
if (LOGGER.isLoggable(Level.FINER)) {

Check warning on line 405 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 405 is only partially covered, one branch is missing
LOGGER.log(Level.FINER, "Repository uri {0} matches notified uri {1} in project {2}", new Object[]{remoteURL, uri, project.getFullDisplayName()});

Check warning on line 406 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 406 is not covered by tests
}
repositoryMatches = true;
matchedURL = remoteURL;
break;
}
}

if (!repositoryMatches || git.getExtensions().get(IgnoreNotifyCommit.class)!=null) {
if (!repositoryMatches) {
if (LOGGER.isLoggable(Level.FINER)) {

Check warning on line 415 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 415 is only partially covered, one branch is missing
LOGGER.log(Level.FINER, "No matching repository uri for notified uri {0} in project {1}", new Object[]{uri, project.getFullDisplayName()});

Check warning on line 416 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 416 is not covered by tests
}
continue;
}

if (git.getExtensions().get(IgnoreNotifyCommit.class)!=null) {

Check warning on line 421 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 421 is only partially covered, one branch is missing
if (LOGGER.isLoggable(Level.FINER)) {
LOGGER.log(Level.FINER, "Ignoring notified uri {0} match in project {1} due to ignore notify commit setting", new Object[]{uri, project.getFullDisplayName()});

Check warning on line 423 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 422-423 are not covered by tests
}
continue;
}

Expand All @@ -422,6 +439,9 @@
branchFound = true;
} else {
OUT: for (BranchSpec branchSpec : git.getBranches()) {
if (LOGGER.isLoggable(Level.FINEST)) {

Check warning on line 442 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 442 is only partially covered, one branch is missing
LOGGER.log(Level.FINEST, "Comparing modified branches {0} against branch {1} in project {2}", new Object[]{Arrays.toString(branches), branchSpec.getName(), project.getFullDisplayName()});

Check warning on line 443 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 443 is not covered by tests
}
if (branchSpec.getName().contains("$")) {
// If the branchspec is parametrized, always run the polling
if (LOGGER.isLoggable(Level.FINE)) {
Expand All @@ -442,7 +462,12 @@
}
}
}
if (!branchFound) continue;
if (!branchFound) {
if (LOGGER.isLoggable(Level.FINER)) {

Check warning on line 466 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 466 is only partially covered, one branch is missing
LOGGER.log(Level.FINER, "No matching branch spec for modified branches {0} in project {1}", new Object[]{Arrays.toString(branches), project.getFullDisplayName()});

Check warning on line 467 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 467 is not covered by tests
}
continue;
}
urlFound = true;
if (!(project instanceof ParameterizedJobMixIn.ParameterizedJob<?,?> job && job.isDisabled())) {
//JENKINS-30178 Add default parameters defined in the job
Expand Down Expand Up @@ -499,6 +524,12 @@
}

lastStaticBuildParameters = allBuildParameters;

if (LOGGER.isLoggable(Level.FINER)) {

Check warning on line 528 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 528 is only partially covered, one branch is missing
LOGGER.log(Level.FINER, "Processed notification from {0} for uri = {1} ; sha1 = {2} ; branches = {3} in {4} ms",
new Object[]{StringUtils.defaultIfBlank(origin, "?"), uri, sha1, Arrays.toString(branches), System.currentTimeMillis() - startMs});

Check warning on line 530 in src/main/java/hudson/plugins/git/GitStatus.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 529-530 are not covered by tests
}

return result;
}
}
Expand Down
Loading