Add Worker logic for git commands. Still wip
@@ -3,8 +3,11 @@ package io.jenkins.plugins.analysis.core.scm;
import java.io.IOException;
import java.io.Serializable;
import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
import java.util.logging.Logger;
+import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
@@ -16,6 +19,8 @@ import org.jenkinsci.plugins.gitclient.RepositoryCallback;
import hudson.FilePath;
import hudson.remoting.VirtualChannel;
+import io.jenkins.plugins.analysis.core.scm.analyzer.GitLastChangeOfFile;
+
public class GsWorker implements Serializable {
private static final Logger LOGGER = Logger.getLogger(GsWorker.class.getName());
@@ -82,6 +87,18 @@ public class GsWorker implements Serializable {
@Override
public GsResults invoke(final Repository repository, final VirtualChannel virtualChannel)
throws IOException, InterruptedException {
+ Map<String, Integer> lastChangedPerFile = new HashMap<>();
+ try {
+ Git git = new Git(repository);
+ GitLastChangeOfFile gitLastChangeOfFile = new GitLastChangeOfFile();
+ lastChangedPerFile = gitLastChangeOfFile.collectResults(git);
+ }
+ catch (Exception e) {
+ report.logInfo("Error reading git for filechanges", e);
+ }
+ for (Map.Entry<String, Integer> entry : lastChangedPerFile.entrySet()) {
+
+ }
return new GsResults();
}
