summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorLluis Sanchez2010-10-26 05:18:18 (EDT)
committer Chris Aniszczyk2010-10-26 14:27:40 (EDT)
commit07cae6e6c1d6982cf6b919e90e79330793c74a15 (patch)
treeec70720e184e15a1f799985f3aa3ea7ded74977c
parente10808e6585fe16956bda294bcc3ffbaa1410a1c (diff)
downloadjgit-07cae6e6c1d6982cf6b919e90e79330793c74a15.zip
jgit-07cae6e6c1d6982cf6b919e90e79330793c74a15.tar.gz
jgit-07cae6e6c1d6982cf6b919e90e79330793c74a15.tar.bz2
Optimize DirCacheCheckoutrefs/changes/82/1782/4
When checking out a tree, files that are identical to the file in the current index and working directory don't need to be updated. Change-Id: I9e025a53facd42410796eae821baaeff684a25c5 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java9
1 files changed, 7 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
index 03d2b8e..f521504 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
@@ -273,8 +273,13 @@ public class DirCacheCheckout {
void processEntry(CanonicalTreeParser m, DirCacheBuildIterator i,
WorkingTreeIterator f) {
if (m != null) {
- update(m.getEntryPathString(), m.getEntryObjectId(),
- m.getEntryFileMode());
+ if (i == null || f == null || !m.idEqual(i)
+ || f.isModified(i.getDirCacheEntry(), true,
+ config_filemode(), repo.getFS())) {
+ update(m.getEntryPathString(), m.getEntryObjectId(),
+ m.getEntryFileMode());
+ } else
+ keep(i.getDirCacheEntry());
} else {
if (f != null) {
if (walk.isDirectoryFileConflict()) {