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>
This commit is contained in:
Lluis Sanchez 2010-10-26 11:18:18 +02:00 committed by Chris Aniszczyk
parent e10808e658
commit 07cae6e6c1
1 changed files with 7 additions and 2 deletions

View File

@ -273,8 +273,13 @@ public void prescanOneTree()
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()) {