summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src
diff options
context:
space:
mode:
authorChristian Halstrick <christian.halstrick@sap.com>2013-07-11 02:32:37 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2013-07-11 02:32:37 -0400
commitde00ec94d83b1a7c87856841e64db15d3b6c853d (patch)
tree445af15cd64faa8f3b202f263c9da39d5f098f67 /org.eclipse.jgit/src
parentf45288e7c43ff1756c231988f7b4ae3e0296d070 (diff)
parent56ee8117802a672e80011ee07ea6b253a5b7d0a9 (diff)
downloadjgit-de00ec94d83b1a7c87856841e64db15d3b6c853d.tar.gz
jgit-de00ec94d83b1a7c87856841e64db15d3b6c853d.zip
Merge "Fix bugs in TreeWalk#isPathSuffix used by PathSuffixFilter"
Diffstat (limited to 'org.eclipse.jgit/src')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
index 627df927b4..90850eafda 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/TreeWalk.java
@@ -835,13 +835,17 @@ public class TreeWalk {
final AbstractTreeIterator t = currentHead;
final byte[] c = t.path;
final int cLen = t.pathLen;
- int ci;
- for (ci = 1; ci < cLen && ci < pLen; ci++) {
- if (c[cLen-ci] != p[pLen-ci])
+ for (int i = 1; i <= pLen; i++) {
+ // Pattern longer than current path
+ if (i > cLen)
+ return false;
+ // Current path doesn't match pattern
+ if (c[cLen - i] != p[pLen - i])
return false;
}
+ // Whole pattern tested -> matches
return true;
}