Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

When creating a tracking branch pre-fill the branch name in the creat…

…e branch sheet
  • Loading branch information...
commit e388434a493b74386fbefdbab0f9c57f51004fe2 1 parent 929f9fc
@brotherbard brotherbard authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 PBCreateBranchSheet.m
View
10 PBCreateBranchSheet.m
@@ -51,6 +51,16 @@ - (void) beginCreateBranchSheetAtRefish:(id <PBGitRefish>)ref inRepository:(PBGi
[self.errorMessageField setStringValue:@""];
self.shouldCheckoutBranch = [PBGitDefaults shouldCheckoutBranch];
+ // when creating a local branch tracking a remote branch preset the branch name to the name of the remote branch
+ if ([self.startRefish refishType] == kGitXRemoteBranchType) {
+ NSMutableArray *components = [[[self.startRefish shortName] componentsSeparatedByString:@"/"] mutableCopy];
+ if ([components count] > 1) {
+ [components removeObjectAtIndex:0];
+ NSString *branchName = [components componentsJoinedByString:@"/"];
+ [self.branchNameField setStringValue:branchName];
+ }
+ }
+
[NSApp beginSheet:[self window] modalForWindow:[self.repository.windowController window] modalDelegate:self didEndSelector:nil contextInfo:NULL];
}
Please sign in to comment.
Something went wrong with that request. Please try again.