aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorXing Huang <xingkhuang@google.com>2024-03-07 11:41:36 -0600
committerXing Huang <xingkhuang@google.com>2024-03-18 12:17:07 -0500
commit72fa0a53e79265c11703ce848408ed328aed1e55 (patch)
treeb5e8040596db494be955b4a7097b52de86a67275 /org.eclipse.jgit
parent9e841dd4ac8435b97333c380eaa34e7bf01be97e (diff)
downloadjgit-72fa0a53e79265c11703ce848408ed328aed1e55.tar.gz
jgit-72fa0a53e79265c11703ce848408ed328aed1e55.zip
TreeRevFilter: correct changedPathFilter usage for multi-paths inclusion
The expected behavior of TreeRevFilter when filtering multiple file paths is to include commits that changed at least one of the given paths; only skipping them if they did not change any of the given paths. The current changedPathFilter utilization logic is skipping a commit if there exists at least one given path that the commit did not change, disregarding the rest of the given paths. Enforcing all given paths to be checked by the changedPathFilter, only skipping a commit if changedPathFilter return negative on all given paths. Signed-off-by: Xing Huang <xingkhuang@google.com> Change-Id: Ib7a9e496b37ec737722fbf33c5d0f05d5d910a8d
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java2
2 files changed, 3 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java
index 43571a6868..99943b78e6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java
@@ -139,11 +139,8 @@ public class TreeRevFilter extends RevFilter {
.getPathsBestEffort();
if (paths.isPresent()) {
changedPathFilterUsed = true;
- for (byte[] path : paths.get()) {
- if (!cpf.maybeContains(path)) {
- mustCalculateChgs = false;
- break;
- }
+ if (paths.get().stream().noneMatch(cpf::maybeContains)) {
+ mustCalculateChgs = false;
}
}
}
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java
index 22d430bc27..a9066dc8f8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/filter/TreeFilter.java
@@ -210,7 +210,7 @@ public abstract class TreeFilter {
public abstract boolean shouldBeRecursive();
/**
- * If this filter checks that a specific set of paths have all been
+ * If this filter checks that at least one of the paths in a set has been
* modified, returns that set of paths to be checked against a changed path
* filter. Otherwise, returns empty.
*