diff options
author | Lluis Sanchez | 2010-10-26 09:18:18 +0000 |
---|---|---|
committer | Chris Aniszczyk | 2010-10-26 18:27:40 +0000 |
commit | 07cae6e6c1d6982cf6b919e90e79330793c74a15 (patch) | |
tree | ec70720e184e15a1f799985f3aa3ea7ded74977c | |
parent | e10808e6585fe16956bda294bcc3ffbaa1410a1c (diff) | |
download | jgit-07cae6e6c1d6982cf6b919e90e79330793c74a15.tar.gz jgit-07cae6e6c1d6982cf6b919e90e79330793c74a15.tar.xz jgit-07cae6e6c1d6982cf6b919e90e79330793c74a15.zip |
Optimize DirCacheCheckout
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.java | 9 |
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 03d2b8e9c8..f52150457d 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()) { |