Skip to content

Commit

Permalink
When creating a tracking branch pre-fill the branch name in the creat…
Browse files Browse the repository at this point in the history
…e branch sheet
  • Loading branch information
brotherbard committed Sep 20, 2010
1 parent 929f9fc commit e388434
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions PBCreateBranchSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down

0 comments on commit e388434

Please sign in to comment.