From b243e86a58fd84b22a4fa67e851fbfe2844d8f45 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Fri, 26 Sep 2008 00:37:28 +0200 Subject: [PATCH] CommitController: Don't show files that are in conflict twice --- PBGitCommitController.m | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/PBGitCommitController.m b/PBGitCommitController.m index bb70d61..6cd38f0 100644 --- a/PBGitCommitController.m +++ b/PBGitCommitController.m @@ -119,7 +119,18 @@ PBChangedFile *file = [[PBChangedFile alloc] initWithPath:[components objectAtIndex:1] andRepository:repository]; file.status = MODIFIED; file.cached = NO; - [unstagedFilesController addObject: file]; + + // FIXME: If you are in a merge and have conflicts, a file is displayed twice, with different + // index values. For now, we don't handle this gracefully. + BOOL fileExists = NO; + for (PBChangedFile *object in [unstagedFilesController arrangedObjects]) { + if ([[object path] isEqualToString:[file path]]) { + fileExists = YES; + break; + } + } + if (!fileExists) + [unstagedFilesController addObject: file]; } [self doneProcessingIndex]; }