From 2b8d378f1300580846f9b5de93f43f40313deae8 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Mon, 23 Mar 2009 22:43:48 +0000 Subject: [PATCH] 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. --- PBGitCommitController.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PBGitCommitController.m b/PBGitCommitController.m index de5f692..bc67878 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -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]; }