1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.ignore.internal;
11
12
13
14
15
16
17
18 public final class WildMatcher extends AbstractMatcher {
19
20 static final String WILDMATCH = "**";
21
22
23 static final String WILDMATCH2 = "/**";
24
25 WildMatcher(boolean dirOnly) {
26 super(WILDMATCH, dirOnly);
27 }
28
29
30 @Override
31 public final boolean matches(String path, boolean assumeDirectory,
32 boolean pathMatch) {
33 return !dirOnly || assumeDirectory
34 || (!pathMatch && isSubdirectory(path));
35 }
36
37
38 @Override
39 public final boolean matches(String segment, int startIncl, int endExcl) {
40 return true;
41 }
42
43 private static boolean isSubdirectory(String path) {
44 final int slashIndex = path.indexOf('/');
45 return slashIndex >= 0 && slashIndex < path.length() - 1;
46 }
47 }