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

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

Introduction

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

Prototype

public boolean isModified(DirCacheEntry entry, boolean forceContentCheck, ObjectReader reader)
        throws IOException 

Source Link

Document

Checks whether this entry differs from a given entry from the org.eclipse.jgit.dircache.DirCache .

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;
    }//w  w w .  j  a va 2 s  . c o 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;
}