Skip to content

Commit

Permalink
Implement review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik committed Oct 4, 2020
1 parent 1ae409e commit 13c7b2b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public boolean isClean(Project project, ObjectId treeSha, File file) throws IOEx
* true if that file is clean relative to that tree. A naive implementation of this
* could be verrrry slow, so the rest of this is about speeding this up.
*/
public boolean isClean(Project project, ObjectId treeSha, String relativePath) throws IOException {
public boolean isClean(Project project, ObjectId treeSha, String relativePathUnix) throws IOException {
Repository repo = repositoryFor(project);

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

if (!treeWalk.next()) {
Expand All @@ -108,7 +108,7 @@ public boolean isClean(Project project, ObjectId treeSha, String relativePath) t
} else if (treeEqualsIndex) {
// this means they are all equal to each other, which should never happen
// the IndexDiffFilter should keep those out of the TreeWalk entirely
throw new IllegalStateException("Index status for " + relativePath + " against treeSha " + treeSha + " is invalid.");
throw new IllegalStateException("Index status for " + relativePathUnix + " against treeSha " + treeSha + " is invalid.");
} else {
// they are all unique
// we have to check manually
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -195,7 +194,7 @@ private List<File> collectFilesFromGit(FormatterFactory formatterFactory, String
for (String file : withNormalizedFileSeparators(dirtyFiles)) {
if (includePatterns.matches(file, true)) {
if (!excludePatterns.matches(file, true)) {
result.add(Paths.get(baseDir.getPath(), file).toFile());
result.add(new File(baseDir.getPath(), file));
}
}
}
Expand Down

0 comments on commit 13c7b2b

Please sign in to comment.