Skip to content

Commit 12ca779

Browse files
committed
avoids sorting stashes in the sidebar so that they keep their natural order as returned from git
1 parent 5ea2d5e commit 12ca779

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Model/PBGitStash.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ - (NSString *) description {
3737
#pragma mark Presentable
3838

3939
- (NSString *) displayDescription {
40-
return [NSString stringWithFormat:@"%@ (%@)", self.message, self.name];
40+
return [NSString stringWithFormat:@"%@: %@", self.name, self.message];
4141
}
4242

4343
- (NSString *) popupDescription {

PBGitSidebarController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
127127
PBGitMenuItem *lastItem = nil;
128128
for (PBGitStash *stash in newStashes) {
129129
PBGitMenuItem *item = [[PBGitMenuItem alloc] initWithSourceObject:stash];
130-
[stashes addChild:item];
130+
[stashes addChildWithoutSort:item];
131131
lastItem = item;
132132
}
133133
if (lastItem) {

PBSourceViewItem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- (NSString *)helpText;
2828

2929
- (void)addChild:(PBSourceViewItem *)child;
30+
- (void)addChildWithoutSort:(PBSourceViewItem *)child;
3031
- (void)removeChild:(PBSourceViewItem *)child;
3132

3233
// This adds the ref to the path, which should match the item's title,

PBSourceViewItem.m

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ - (void)addChild:(PBSourceViewItem *)child
6262
[self.children sortUsingDescriptors:[NSArray arrayWithObject:[[NSSortDescriptor alloc] initWithKey:@"title" ascending:YES selector:@selector(localizedCaseInsensitiveCompare:)]]];
6363
}
6464

65+
- (void)addChildWithoutSort:(PBSourceViewItem *)child
66+
{
67+
if (!child)
68+
return;
69+
70+
[self.children addObject:child];
71+
child.parent = self;
72+
}
73+
6574
- (void)removeChild:(PBSourceViewItem *)child
6675
{
6776
if (!child)

0 commit comments

Comments
 (0)