From da538e063749b7084dc178e313ce40d5a2bda259 Mon Sep 17 00:00:00 2001 From: Georg Seibt <seibt@fim.uni-passau.de> Date: Fri, 21 Oct 2016 15:39:26 +0200 Subject: [PATCH] use Path to represent affected file for consistency with the rest of the library --- .../uni_passau/fim/seibt/gitwrapper/repo/BlameLine.java | 9 +++++---- .../uni_passau/fim/seibt/gitwrapper/repo/Repository.java | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/BlameLine.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/BlameLine.java index 2e6d80a..fe623a7 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/BlameLine.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/BlameLine.java @@ -1,6 +1,7 @@ package de.uni_passau.fim.seibt.gitwrapper.repo; import java.io.File; +import java.nio.file.Path; import java.util.Collections; import java.util.Map; @@ -27,7 +28,7 @@ public class BlameLine { /** * The file in the commit that the line is attributed to. */ - public final File file; + public final Path file; /** * The actual line from the file. @@ -55,7 +56,7 @@ public class BlameLine { * @param otherHeaderFields * other (unrecognized) fields from the 'git blame' commit header */ - private BlameLine(Commit commit, int originalLineNumber, int finalLineNumber, File file, String line, + private BlameLine(Commit commit, int originalLineNumber, int finalLineNumber, Path file, String line, Map<String, String> otherHeaderFields) { this.commit = commit; @@ -84,7 +85,7 @@ public class BlameLine { * other (unrecognized) fields from the 'git blame' commit header * @return a {@link BlameLine} containing the given header fields */ - static BlameLine firstOccurrence(Commit commit, int originalLineNumber, int finalLineNumber, File file, String line, + static BlameLine firstOccurrence(Commit commit, int originalLineNumber, int finalLineNumber, Path file, String line, Map<String, String> otherHeaderFields) { Map<String, String> other; @@ -118,7 +119,7 @@ public class BlameLine { String line) { Commit commit = firstOccurrence.commit; - File file = firstOccurrence.file; + Path file = firstOccurrence.file; Map<String, String> otherHeaderFields = firstOccurrence.otherHeaderFields; return new BlameLine(commit, originalLineNumber, finalLineNumber, file, line, otherHeaderFields); diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java index 4a5edc0..c544a13 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Repository.java @@ -434,7 +434,7 @@ public class Repository { ZoneId authorTZ = null; ZoneId committerTZ = null; - File commitFile = null; + Path commitFile = null; Map<String, String> other = new HashMap<>(); @@ -471,7 +471,7 @@ public class Repository { committerTZ = ZoneId.of(lineScanner.next()); break; case FILENAME: - commitFile = dir.toPath().resolve(Paths.get(lineScanner.nextLine().trim())).toFile(); + commitFile = Paths.get(lineScanner.nextLine().trim()); break; case SUMMARY: // We do not explicitly store the summary of the commit as it is just the first line of its message (for which there is a getter). -- GitLab