From e388434a493b74386fbefdbab0f9c57f51004fe2 Mon Sep 17 00:00:00 2001 From: Nathan Kinsinger Date: Sun, 19 Sep 2010 12:47:06 -0600 Subject: [PATCH] When creating a tracking branch pre-fill the branch name in the create branch sheet --- PBCreateBranchSheet.m | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PBCreateBranchSheet.m b/PBCreateBranchSheet.m index ebd2643..0eb8d2a 100644 --- a/PBCreateBranchSheet.m +++ b/PBCreateBranchSheet.m @@ -51,6 +51,16 @@ [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]; }