From 06f737df9af9633974b0afdf9af556532394fecd Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Sat, 6 Sep 2008 23:00:41 +0200 Subject: [PATCH] Use PBGitRef for other refs --- English.lproj/RepositoryWindow.xib | 159 +++++++++++++++++------------ PBGitRepository.m | 9 +- PBGitRevisionCell.m | 2 +- 3 files changed, 96 insertions(+), 74 deletions(-) diff --git a/English.lproj/RepositoryWindow.xib b/English.lproj/RepositoryWindow.xib index e1f2ac1..7ece8d3 100644 --- a/English.lproj/RepositoryWindow.xib +++ b/English.lproj/RepositoryWindow.xib @@ -8,7 +8,7 @@ 352.00 YES - + YES @@ -73,9 +73,10 @@ - + 265 {{0, 14}, {183, 22}} + YES 343014976 @@ -171,9 +172,10 @@ Branch - + 268 {{0, 14}, {134, 26}} + YES -2076049856 @@ -281,9 +283,10 @@ View selector - + 268 {{0, 14}, {114, 23}} + YES 67239424 @@ -1761,6 +1764,23 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ YES YES + + + YES + branches.refs + refs + ref + value + shortName + + YES + + YES + YES + YES + YES + YES + @@ -2054,68 +2074,6 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ 108 - - - contentValues: repository.branches - - - - - - contentValues: repository.branches - contentValues - repository.branches - 2 - - - 118 - - - - selectedValue: repository.currentBranch - - - - - - selectedValue: repository.currentBranch - selectedValue - repository.currentBranch - - YES - - YES - NSAllowsEditingMultipleValuesSelection - NSAlwaysPresentsApplicationModalAlerts - NSConditionallySetsEnabled - NSConditionallySetsHidden - NSMultipleValuesPlaceholder - NSNoSelectionPlaceholder - NSNotApplicablePlaceholder - NSNullPlaceholder - NSRaisesForNotApplicableKeys - NSValidatesImmediately - - - YES - - - - - - - - Not on branch - - - - - - 2 - - - 120 - delegate @@ -2229,6 +2187,59 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ 133 + + + contentArray: repository.branches + + + + + + contentArray: repository.branches + contentArray + repository.branches + 2 + + + 171 + + + + contentValues: arrangedObjects.shortName + + + + + + contentValues: arrangedObjects.shortName + contentValues + arrangedObjects.shortName + 2 + + + 209 + + + + selectedValue: repository.currentBranch + + + + + + selectedValue: repository.currentBranch + selectedValue + repository.currentBranch + + NSNullPlaceholder + Not on branch + + + 2 + + + 210 + @@ -2764,6 +2775,12 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ CommitsController + + 169 + + + BranchesController + @@ -2785,6 +2802,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ 15.IBViewIntegration.shadowOffsetHeight 15.IBViewIntegration.shadowOffsetWidth 15.ImportedFromIB2 + 169.IBPluginDependency 17.IBPluginDependency 17.ImportedFromIB2 18.IBPluginDependency @@ -2841,6 +2859,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ 6.IBPluginDependency 60.IBPluginDependency 61.IBPluginDependency + 62.IBEditorWindowLastContentRect 62.IBPluginDependency 62.editorWindowContentRectSynchronizationRect 63.IBPluginDependency @@ -2883,6 +2902,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -2913,7 +2933,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ PBQLOutlineView com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{429, 794}, {616, 0}} + {{429, 567}, {616, 227}} com.apple.InterfaceBuilder.CocoaPlugin {{132, 614}, {616, 0}} com.apple.InterfaceBuilder.CocoaPlugin @@ -2938,6 +2958,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + {{725, 616}, {134, 63}} com.apple.InterfaceBuilder.CocoaPlugin {{848, 458}, {116, 63}} com.apple.InterfaceBuilder.CocoaPlugin @@ -2975,7 +2996,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ - 133 + 210 @@ -2988,6 +3009,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ YES openSelectedFile: + refresh: setDetailedView: setRawView: setTreeView: @@ -3000,6 +3022,7 @@ ELIAAAAAAAgACAAIAAgAAQABAAEAAQ id id id + id diff --git a/PBGitRepository.m b/PBGitRepository.m index 584a115..4baadcb 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -12,6 +12,7 @@ #import "NSFileHandleExt.h" #import "PBEasyPipe.h" +#import "PBGitRef.h" NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain"; @@ -147,7 +148,7 @@ static NSString* gitPath; NSMutableArray* newBranches = [NSMutableArray array]; for (NSString* line in lines) { NSArray* components = [line componentsSeparatedByString:@" "]; - NSString* ref = [components objectAtIndex:0]; + PBGitRef* ref = [PBGitRef refFromString:[components objectAtIndex:0]]; NSString* type = [components objectAtIndex:1]; NSString* sha; if ([type isEqualToString:@"tag"] && [components count] == 4) @@ -155,10 +156,8 @@ static NSString* gitPath; else sha = [components objectAtIndex:2]; - if ([ref length] > 11 && [[ref substringToIndex:11] isEqualToString:@"refs/heads/"]) { - NSString* branch = [ref substringFromIndex:11]; - [newBranches addObject: branch]; - } + if ([[ref type] isEqualToString:@"head"]) + [newBranches addObject: ref]; NSMutableArray* curRefs; if (curRefs = [newRefs objectForKey:sha]) diff --git a/PBGitRevisionCell.m b/PBGitRevisionCell.m index 2e65800..5858fca 100644 --- a/PBGitRevisionCell.m +++ b/PBGitRevisionCell.m @@ -175,7 +175,7 @@ int index; for (index = 0; index < [cellInfo.refs count]; ++index) { - PBGitRef* ref = [PBGitRef refFromString:[cellInfo.refs objectAtIndex:index]]; + PBGitRef* ref = [cellInfo.refs objectAtIndex:index]; NSMutableDictionary* attributes = [self attributesForRefLabelSelected:[self isHighlighted]]; NSSize refSize = [[ref shortName] sizeWithAttributes:attributes];