Skip to content
This repository was archived by the owner on Sep 30, 2025. It is now read-only.

Commit 6374c8e

Browse files
authored
Merge pull request #208 from tomvin6/eli_scm_30.4
defect #832120: Jenkins plugin - scm lines enrichment is failing if …
2 parents 270231e + d5fa69f commit 6374c8e

File tree

1 file changed

+8
-5
lines changed
  • src/main/java/com/microfocus/application/automation/tools/octane/model/processors/scm

1 file changed

+8
-5
lines changed

src/main/java/com/microfocus/application/automation/tools/octane/model/processors/scm/GitSCMProcessor.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,14 @@ private SCMData enrichLinesOnSCMData(SCMData scmData, AbstractBuild build) {
9797
if (workspace != null) {
9898
File repoDir = new File(getRemoteString(build) + File.separator + ".git");
9999
scmData = workspace.act(new LineEnricherCallable(repoDir, scmData));
100+
logger.info("Line enricher: process took: " + ((System.currentTimeMillis() - startTime) / 1000) + " seconds");
101+
}
102+
else {
103+
logger.warn("Line enricher: workspace is null");
100104
}
101105
} catch (Exception e1) {
102-
logger.error("Line enricher: FAILED. could not enrich lines on SCM Data " + e1);
106+
logger.error("Line enricher: FAILED. could not enrich lines on SCM Data ", e1);
103107
}
104-
logger.info("Line enricher: process took: " + ((System.currentTimeMillis() - startTime) / 1000) + " seconds");
105108
return scmData;
106109
}
107110

@@ -349,7 +352,7 @@ public SCMData invoke(File rootDir, VirtualChannel channel) throws IOException {
349352
df.setDetectRenames(true);
350353

351354
//add blame data to scm data
352-
Set<String> committedFiles = getCommittedFiles(scmData);
355+
Set<String> committedFiles = getAddedOrEditedFiles(scmData);
353356
List<SCMFileBlame> fileBlameList = getBlameData(repo, committedFiles);
354357
scmData.setFileBlameList(fileBlameList);
355358

@@ -396,10 +399,10 @@ public SCMData invoke(File rootDir, VirtualChannel channel) throws IOException {
396399
}
397400
}
398401

399-
private static Set<String> getCommittedFiles(SCMData scmData) {
402+
private static Set<String> getAddedOrEditedFiles(SCMData scmData) {
400403
Set<String> filesCommittedInPPR = new HashSet<>();
401404
for (SCMCommit curCommit : scmData.getCommits()) {
402-
curCommit.getChanges().forEach(change -> filesCommittedInPPR.add(change.getFile()));
405+
curCommit.getChanges().stream().filter(change -> !change.getType().equals("delete")).forEach(change -> filesCommittedInPPR.add(change.getFile()));
403406
}
404407
return filesCommittedInPPR;
405408
}

0 commit comments

Comments
 (0)