Example usage for org.eclipse.jgit.lib FileMode TYPE_MASK

List of usage examples for org.eclipse.jgit.lib FileMode TYPE_MASK

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib FileMode TYPE_MASK.

Prototype

int TYPE_MASK

To view the source code for org.eclipse.jgit.lib FileMode TYPE_MASK.

Click Source Link

Document

Mask to apply to a file mode to obtain its type bits.

Usage

From source file:com.google.gerrit.server.git.GitModules.java

License:Apache License

void load() throws IOException {
    Project.NameKey project = branch.getParentKey();
    logDebug("Loading .gitmodules of {} for project {}", branch, project);
    try {//from   ww w  . j  a  v  a  2  s .co  m
        orm.openRepo(project, false);
    } catch (NoSuchProjectException e) {
        throw new IOException(e);
    }
    OpenRepo or = orm.getRepo(project);

    ObjectId id = or.repo.resolve(branch.get());
    if (id == null) {
        throw new IOException("Cannot open branch " + branch.get());
    }
    RevCommit commit = or.rw.parseCommit(id);

    TreeWalk tw = TreeWalk.forPath(or.repo, GIT_MODULES, commit.getTree());
    if (tw == null || (tw.getRawMode(0) & FileMode.TYPE_MASK) != FileMode.TYPE_FILE) {
        return;
    }
    try {
        BlobBasedConfig bbc = new BlobBasedConfig(null, or.repo, commit, GIT_MODULES);
        subscriptions = subSecParserFactory.create(bbc, thisServer, branch).parseAllSections();
    } catch (ConfigInvalidException e) {
        throw new IOException("Could not read .gitmodule file of super project: " + branch.getParentKey(), e);
    }
}

From source file:com.googlesource.gerrit.plugins.uploadvalidator.SubmoduleValidator.java

License:Apache License

private static boolean isSubmodule(TreeWalk tw) {
    return (tw.getRawMode(0) & FileMode.TYPE_MASK) == FileMode.TYPE_GITLINK;
}

From source file:com.googlesource.gerrit.plugins.uploadvalidator.SymlinkValidator.java

License:Apache License

private static boolean isSymLink(TreeWalk tw) {
    return (tw.getRawMode(0) & FileMode.TYPE_MASK) == FileMode.TYPE_SYMLINK;
}