Index: Don't rearrange on every object

We used to change the PBFile status every time we found a 
similarly named file. Because the unstagedFilesController
had a filter and sort predicate for these, the array was
rearranged every time an existing file was found. This quickly
leads to stalling.

We fix it by temporarily disabling the automatic rearranging
and then reenabling it when we're finished.
This commit is contained in:
Pieter de Bie
2009-03-23 22:43:48 +00:00
parent b18d9af2aa
commit 2b8d378f13
+4 -2
View File
@@ -139,6 +139,7 @@
- (void) readOtherFiles:(NSNotification *)notification;
{
[unstagedFilesController setAutomaticallyRearrangesObjects:NO];
NSArray *lines = [self linesFromNotification:notification];
for (NSString *line in lines) {
if ([line length] == 0)
@@ -153,7 +154,7 @@
file.status = NEW;
file.hasCachedChanges = NO;
file.hasUnstagedChanges = YES;
continue;
break;
}
}
@@ -167,7 +168,8 @@
file.hasUnstagedChanges = YES;
[files addObject: file];
}
[unstagedFilesController setAutomaticallyRearrangesObjects:YES];
[unstagedFilesController rearrangeObjects];
[self doneProcessingIndex];
}