Example usage for org.eclipse.jgit.treewalk TreeWalk isPathPrefix

List of usage examples for org.eclipse.jgit.treewalk TreeWalk isPathPrefix

Introduction

In this page you can find the example usage for org.eclipse.jgit.treewalk TreeWalk isPathPrefix.

Prototype

public int isPathPrefix(byte[] p, int pLen) 

Source Link

Document

Test if the supplied path matches the current entry's path.

Usage

From source file:org.eclipse.tycho.extras.buildtimestamp.jgit.PathFilter.java

License:Open Source License

@Override
public boolean include(TreeWalk tw) throws MissingObjectException, IncorrectObjectTypeException, IOException {
    if (tw.isPathPrefix(basedir, basedir.length) != 0) {
        // not under basedir, not interesting
        return false;
    }//from  www . j  av  a 2 s .com

    if (!tw.isSubtree() && rules != null) {
        String path = tw.getPathString();
        for (IgnoreRule rule : rules) {
            if (rule.isMatch(path, tw.isSubtree())) {
                return !rule.getResult();
            }
        }
    }

    return true;
}