Skip to content

Commit 5d1632a

Browse files
committed
refactor: Move the default DiffFilter into DiffFilter
1 parent 5bf9c77 commit 5d1632a

2 files changed

Lines changed: 14 additions & 21 deletions

File tree

src/main/java/org/variantsync/diffdetective/datasets/DatasetFactory.java

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,6 @@ public class DatasetFactory {
3333
*/
3434
public static final String PHP = "PHP";
3535

36-
/**
37-
* Default value for diff filters.
38-
* It disallows merge commits, only considers patches that modified files,
39-
* and only allows source files of C/C++ projects ("h", "hpp", "c", "cpp").
40-
*/
41-
public static final DiffFilter DEFAULT_DIFF_FILTER =
42-
new DiffFilter.Builder()
43-
.allowMerge(false)
44-
.allowCommitsWithoutParents(false)
45-
.allowedChangeTypes(DiffEntry.ChangeType.MODIFY)
46-
.allowedFileExtensions("h", "hpp", "c", "cpp")
47-
.build();
48-
// public static final DiffFilter PHP_DIFF_FILTER =
49-
// new DiffFilter.Builder(DEFAULT_DIFF_FILTER)
50-
//// .blockedPaths("ext/fileinfo/data_file.c")
51-
// .build();
52-
5336
private final Path cloneDirectory;
5437

5538
/**
@@ -69,10 +52,7 @@ public static DiffFilter getDefaultDiffFilterFor(final String repositoryName) {
6952
if (repositoryName.equalsIgnoreCase(MARLIN)) {
7053
return StanciulescuMarlin.DIFF_FILTER;
7154
}
72-
// if (repositoryName.equalsIgnoreCase(PHP)) {
73-
// return PHP_DIFF_FILTER;
74-
// }
75-
return DEFAULT_DIFF_FILTER;
55+
return DiffFilter.DEFAULT_DIFF_FILTER;
7656
}
7757

7858
/**

src/main/java/org/variantsync/diffdetective/diff/git/DiffFilter.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ public class DiffFilter {
2727
.allowAllFileExtensions()
2828
.build();
2929

30+
/**
31+
* Default value for diff filters.
32+
* It disallows merge commits, only considers patches that modified files,
33+
* and only allows source files of C/C++ projects ("h", "hpp", "c", "cpp").
34+
*/
35+
public static final DiffFilter DEFAULT_DIFF_FILTER =
36+
new DiffFilter.Builder()
37+
.allowMerge(false)
38+
.allowCommitsWithoutParents(false)
39+
.allowedChangeTypes(DiffEntry.ChangeType.MODIFY)
40+
.allowedFileExtensions("h", "hpp", "c", "cpp")
41+
.build();
42+
3043
/**
3144
* A list of allowed file extensions for patches.
3245
* When this list is not empty all file extension that it does not contain will be filtered.

0 commit comments

Comments
 (0)