Example usage for org.eclipse.jgit.treewalk WorkingTreeIterator isModeDifferent

List of usage examples for org.eclipse.jgit.treewalk WorkingTreeIterator isModeDifferent

Introduction

In this page you can find the example usage for org.eclipse.jgit.treewalk WorkingTreeIterator isModeDifferent.

Prototype

public boolean isModeDifferent(int rawMode) 

Source Link

Document

Is the file mode of the current entry different than the given raw mode?

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 w ww  .j ava  2  s.co m*/

    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;
}