Skip to content

Commit 515c16c

Browse files
author
Erik
committed
Implement review suggestions
1 parent 1ae409e commit 515c16c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib-extra/src/main/java/com/diffplug/spotless/extra/GitRatchet.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public boolean isClean(Project project, ObjectId treeSha, File file) throws IOEx
6969
* true if that file is clean relative to that tree. A naive implementation of this
7070
* could be verrrry slow, so the rest of this is about speeding this up.
7171
*/
72-
public boolean isClean(Project project, ObjectId treeSha, String relativePath) throws IOException {
72+
public boolean isClean(Project project, ObjectId treeSha, String relativePathUnix) throws IOException {
7373
Repository repo = repositoryFor(project);
7474

7575
// TODO: should be cached-per-repo if it is thread-safe, or per-repo-per-thread if it is not
@@ -81,7 +81,7 @@ public boolean isClean(Project project, ObjectId treeSha, String relativePath) t
8181
treeWalk.addTree(new DirCacheIterator(dirCache));
8282
treeWalk.addTree(new FileTreeIterator(repo));
8383
treeWalk.setFilter(AndTreeFilter.create(
84-
PathFilter.create(relativePath),
84+
PathFilter.create(relativePathUnix),
8585
new IndexDiffFilter(INDEX, WORKDIR)));
8686

8787
if (!treeWalk.next()) {
@@ -108,7 +108,7 @@ public boolean isClean(Project project, ObjectId treeSha, String relativePath) t
108108
} else if (treeEqualsIndex) {
109109
// this means they are all equal to each other, which should never happen
110110
// the IndexDiffFilter should keep those out of the TreeWalk entirely
111-
throw new IllegalStateException("Index status for " + relativePath + " against treeSha " + treeSha + " is invalid.");
111+
throw new IllegalStateException("Index status for " + relativePathUnix + " against treeSha " + treeSha + " is invalid.");
112112
} else {
113113
// they are all unique
114114
// we have to check manually

plugin-maven/src/main/java/com/diffplug/spotless/maven/AbstractSpotlessMojo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ private List<File> collectFilesFromGit(FormatterFactory formatterFactory, String
195195
for (String file : withNormalizedFileSeparators(dirtyFiles)) {
196196
if (includePatterns.matches(file, true)) {
197197
if (!excludePatterns.matches(file, true)) {
198-
result.add(Paths.get(baseDir.getPath(), file).toFile());
198+
result.add(new File(baseDir.getPath(), file));
199199
}
200200
}
201201
}

0 commit comments

Comments
 (0)