]> source.dussan.org Git - jgit.git/commit
TreeRevFilter: fix wrong stop when the given path disappears 38/188938/2
authorkylezhao <kylezhao@tencent.com>
Fri, 12 Nov 2021 06:34:46 +0000 (14:34 +0800)
committerMatthias Sohn <matthias.sohn@sap.com>
Thu, 16 Dec 2021 23:29:11 +0000 (00:29 +0100)
commit3d7351ee50b2ef45613b2223856f31e5af1c7ca1
tree2d7fbf9591cfa7962f9c558bf19f29840a7112b2
parent35713588fe739af74081d12fabc6c6017ee56c00
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>
org.eclipse.jgit.test/tst/org/eclipse/jgit/revwalk/RevWalkPathFilter1Test.java
org.eclipse.jgit/src/org/eclipse/jgit/revwalk/TreeRevFilter.java