aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/ByteArraySet.java8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java11
2 files changed, 19 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/ByteArraySet.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/ByteArraySet.java
index c94160144e..bcf79a285d 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/ByteArraySet.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/ByteArraySet.java
@@ -15,6 +15,10 @@ package org.eclipse.jgit.treewalk.filter;
import org.eclipse.jgit.util.RawParseUtils;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.stream.Collectors;
+
/**
* Specialized set for byte arrays, interpreted as strings for use in
* {@link PathFilterGroup.Group}. Most methods assume the hash is already know
@@ -291,4 +295,8 @@ class ByteArraySet {
return ret;
}
+ Set<byte[]> toSet() {
+ return Arrays.stream(toArray()).collect(Collectors.toSet());
+ }
+
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java
index 59855572f2..4c0604ad56 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/PathFilterGroup.java
@@ -12,6 +12,8 @@
package org.eclipse.jgit.treewalk.filter;
import java.util.Collection;
+import java.util.Optional;
+import java.util.Set;
import org.eclipse.jgit.errors.StopWalkException;
import org.eclipse.jgit.internal.JGitText;
@@ -232,6 +234,15 @@ public class PathFilterGroup {
}
@Override
+ public Optional<Set<byte[]>> getPathsBestEffort() {
+ Set<byte[]> result = fullpaths.toSet();
+ if (result.isEmpty()) {
+ return Optional.empty();
+ }
+ return Optional.of(result);
+ }
+
+ @Override
public TreeFilter clone() {
return this;
}