File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -240,7 +240,16 @@ int main(int __unused argc, char __unused *argv[])
240240 NSOperationQueue *deltaQueue = [[NSOperationQueue alloc ] init ];
241241 NSMutableArray *deltaOperations = [NSMutableArray array ];
242242
243- NSArray *keys = [[newTreeState allKeys ] sortedArrayUsingSelector: @selector (compare: )];
243+ // Sort the keys by preferring the ones from the original tree to appear first
244+ // We want to enforce deleting before extracting in the case paths differ only by case
245+ NSArray *keys = [[newTreeState allKeys ] sortedArrayUsingComparator: ^NSComparisonResult (NSString *key1, NSString *key2) {
246+ NSComparisonResult insensitiveCompareResult = [key1 caseInsensitiveCompare: key2];
247+ if (insensitiveCompareResult != NSOrderedSame) {
248+ return insensitiveCompareResult;
249+ }
250+
251+ return originalTreeState[key1] ? NSOrderedAscending : NSOrderedDescending;
252+ }];
244253 for (NSString * key in keys) {
245254 id value = [newTreeState valueForKey: key];
246255
You can’t perform that action at this time.
0 commit comments