Browse Source

Merge "IndexDiff: close SubmoduleWalk and use already loaded DirCache"

next
Christian Halstrick 5 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
101b8ea58f
  1. 20
      org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java

20
org.eclipse.jgit/src/org/eclipse/jgit/lib/IndexDiff.java

@ -536,7 +536,8 @@ public class IndexDiff {
if (ignoreSubmoduleMode != IgnoreSubmoduleMode.ALL) {
IgnoreSubmoduleMode localIgnoreSubmoduleMode = ignoreSubmoduleMode;
SubmoduleWalk smw = SubmoduleWalk.forIndex(repository);
try (SubmoduleWalk smw = new SubmoduleWalk(repository)) {
smw.setTree(new DirCacheIterator(dirCache));
while (smw.next()) {
try {
if (localIgnoreSubmoduleMode == null)
@ -558,12 +559,13 @@ public class IndexDiff {
modified.add(subRepoPath);
recordFileMode(subRepoPath, FileMode.GITLINK);
} else if (ignoreSubmoduleMode != IgnoreSubmoduleMode.DIRTY) {
IndexDiff smid = submoduleIndexDiffs.get(smw
.getPath());
IndexDiff smid = submoduleIndexDiffs
.get(smw.getPath());
if (smid == null) {
smid = new IndexDiff(subRepo,
smw.getObjectId(),
wTreeIt.getWorkingTreeIterator(subRepo));
wTreeIt.getWorkingTreeIterator(
subRepo));
submoduleIndexDiffs.put(subRepoPath, smid);
}
if (smid.diff()) {
@ -577,13 +579,14 @@ public class IndexDiff {
continue;
}
modified.add(subRepoPath);
recordFileMode(subRepoPath, FileMode.GITLINK);
recordFileMode(subRepoPath,
FileMode.GITLINK);
}
}
} else if (missingSubmodules.remove(subRepoPath)) {
// If the directory is there and empty but the submodule
// repository in .git/modules doesn't exist yet it isn't
// "missing".
// If the directory is there and empty but the
// submodule repository in .git/modules doesn't
// exist yet it isn't "missing".
File gitDir = new File(
new File(repository.getDirectory(),
Constants.MODULES),
@ -598,6 +601,7 @@ public class IndexDiff {
}
}
}
}
}

Loading…
Cancel
Save