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

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

Introduction

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

Prototype

int TYPE_MISSING

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

Click Source Link

Document

Bit pattern for #TYPE_MASK matching #MISSING .

Usage

From source file:com.itemis.maven.plugins.unleash.scm.providers.merge.UnleashGitMerger.java

License:Eclipse Distribution License

private boolean isWorktreeDirty(WorkingTreeIterator work, DirCacheEntry ourDce) throws IOException {
    if (work == null) {
        return false;
    }/*from www . j a  v a2 s . c om*/

    final int modeF = this.tw.getRawMode(T_FILE);
    final int modeO = this.tw.getRawMode(T_OURS);

    // Worktree entry has to match ours to be considered clean
    boolean isDirty;
    if (ourDce != null) {
        isDirty = work.isModified(ourDce, true, this.reader);
    } else {
        isDirty = work.isModeDifferent(modeO);
        if (!isDirty && nonTree(modeF)) {
            isDirty = !this.tw.idEqual(T_FILE, T_OURS);
        }
    }

    // Ignore existing empty directories
    if (isDirty && modeF == FileMode.TYPE_TREE && modeO == FileMode.TYPE_MISSING) {
        isDirty = false;
    }
    if (isDirty) {
        this.failingPaths.put(this.tw.getPathString(), MergeFailureReason.DIRTY_WORKTREE);
    }
    return isDirty;
}

From source file:org.kuali.student.svn.model.TestExternalsFusion.java

License:Educational Community License

private void checkTrees(ObjectId originalAggregateId, ObjectId aggregateId)
        throws MissingObjectException, IncorrectObjectTypeException, IOException {

    RevWalk rw = new RevWalk(repo);

    RevCommit originalAggregateCommit = rw.parseCommit(originalAggregateId);

    RevCommit aggregateCommit = rw.parseCommit(aggregateId);

    TreeWalk tw = new TreeWalk(repo);

    tw.addTree(originalAggregateCommit.getTree().getId());
    tw.addTree(aggregateCommit.getTree().getId());

    tw.setRecursive(false);/*from  w  ww  . j  a v a  2s  . c  o m*/

    while (tw.next()) {

        FileMode originalMode = tw.getFileMode(0);

        FileMode fileMode = tw.getFileMode(1);

        if (originalMode.equals(FileMode.TYPE_MISSING) || fileMode.equals(FileMode.TYPE_MISSING))
            continue; // skip where one side or the other does not exist.

        String name = tw.getNameString();

        ObjectId originalObjectId = tw.getObjectId(0);
        ObjectId currentObjectId = tw.getObjectId(1);

        Assert.assertTrue(originalObjectId + " is not equals to " + currentObjectId + " for " + name,
                originalObjectId.equals(currentObjectId));

    }

    tw.release();

    rw.release();
}