When creating a tracking branch pre-fill the branch name in the create branch sheet

This commit is contained in:
Nathan Kinsinger
2010-09-19 12:47:06 -06:00
parent 929f9fc0f5
commit e388434a49
+10
View File
@@ -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];
}