From 69451b8302e9e46b9b2615de1d5b64c83158ea47 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 4 Jan 2012 00:27:56 +0100 Subject: [PATCH] Provide file mode of paths in index from IndexDiff Change-Id: I1d543e2f721987114cc1e1cb0848c234470df794 Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/lib/IndexDiff.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java index 39f732fce..0da9e4224 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java @@ -438,4 +438,15 @@ public class IndexDiff { return ((indexDiffFilter == null) ? Collections. emptySet() : new HashSet(indexDiffFilter.getUntrackedFolders())); } + + /** + * Get the file mode of the given path in the index + * + * @param path + * @return file mode + */ + public FileMode getIndexMode(final String path) { + final DirCacheEntry entry = dirCache.getEntry(path); + return entry != null ? entry.getFileMode() : FileMode.MISSING; + } }