summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java19
1 files changed, 12 insertions, 7 deletions
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 6b2af07631..52fc3db791 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java
@@ -105,7 +105,9 @@ public class IndexDiff {
private Set<String> untracked = new HashSet<String>();
- private Set<String> assumeUnchanged = new HashSet<String>();
+ private Set<String> assumeUnchanged;
+
+ private DirCache dirCache;
/**
* Construct an IndexDiff
@@ -167,7 +169,8 @@ public class IndexDiff {
*/
public boolean diff() throws IOException {
boolean changesExist = false;
- DirCache dirCache = repository.readDirCache();
+ dirCache = repository.readDirCache();
+
TreeWalk treeWalk = new TreeWalk(repository);
treeWalk.setRecursive(true);
// add the trees (tree, dirchache, workdir)
@@ -192,11 +195,6 @@ public class IndexDiff {
WorkingTreeIterator workingTreeIterator = treeWalk.getTree(WORKDIR,
WorkingTreeIterator.class);
- if (dirCacheIterator != null) {
- if (dirCacheIterator.getDirCacheEntry().isAssumeValid())
- assumeUnchanged.add(treeWalk.getPathString());
- }
-
if (treeIterator != null) {
if (dirCacheIterator != null) {
if (!treeIterator.getEntryObjectId().equals(
@@ -290,6 +288,13 @@ public class IndexDiff {
* @return list of files with the flag assume-unchanged
*/
public Set<String> getAssumeUnchanged() {
+ if (assumeUnchanged == null) {
+ HashSet<String> unchanged = new HashSet<String>();
+ for (int i = 0; i < dirCache.getEntryCount(); i++)
+ if (dirCache.getEntry(i).isAssumeValid())
+ unchanged.add(dirCache.getEntry(i).getPathString());
+ assumeUnchanged = unchanged;
+ }
return assumeUnchanged;
}
}