summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorkylezhao <kylezhao@tencent.com>2021-11-12 14:34:46 +0800
committerMatthias Sohn <matthias.sohn@sap.com>2021-12-17 00:29:11 +0100
commit3d7351ee50b2ef45613b2223856f31e5af1c7ca1 (patch)
tree2d7fbf9591cfa7962f9c558bf19f29840a7112b2 /org.eclipse.jgit
parent35713588fe739af74081d12fabc6c6017ee56c00 (diff)
downloadjgit-3d7351ee50b2ef45613b2223856f31e5af1c7ca1.tar.gz
jgit-3d7351ee50b2ef45613b2223856f31e5af1c7ca1.zip
TreeRevFilter: fix wrong stop when the given path disappears
When chgs[i] == adds[i], it indicated that a commit added some files that pList[i] did not have, but didn't mean pList[i] is "empty tree root". Follow the example below: . . └── src └── src └── d1 ==> └── d1 └─ file1 ├─ file1 └── file2 c.parents[i] c The variable chg[i] equals to variable add[i], but commit c.parents[i] is not "empty tree root". We should add an additional check for no paths matching the filter. Bug: 577227 Change-Id: I834e9ddd0de86b108b280a1139519ea962913b38 Signed-off-by: kylezhao <kylezhao@tencent.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java5
1 files changed, 4 insertions, 1 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 e465024311..822fc5320c 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java
@@ -211,7 +211,10 @@ public class TreeRevFilter extends RevFilter {
// "empty tree root" and thus their history is not relevant.
// Cut our grandparents to be an empty list.
//
- pList[i].parents = RevCommit.NO_PARENTS;
+ tw.reset(pList[i].getTree());
+ if (!tw.next()) {
+ pList[i].parents = RevCommit.NO_PARENTS;
+ }
}
// We have an interesting difference relative to this parent.