Skip to content

Commit 760d7c6

Browse files
committed
Rewire rebase
1 parent 97b287a commit 760d7c6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Classes/Controllers/PBGitWindowController.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ - (IBAction)merge:(id)sender
647647

648648
- (IBAction)rebase:(id)sender
649649
{
650-
id <PBGitRefish> refish = [self refishForSender:sender refishTypes:@[kGitXBranchType, kGitXRemoteBranchType]];
650+
id <PBGitRefish> refish = [self refishForSender:sender refishTypes:@[kGitXCommitType]];
651651
if (!refish) return;
652652

653653
NSError *error = nil;
@@ -659,7 +659,10 @@ - (IBAction)rebase:(id)sender
659659

660660
- (IBAction)rebaseHeadBranch:(id)sender
661661
{
662-
id <PBGitRefish> refish = [self refishForSender:sender refishTypes:@[kGitXBranchType, kGitXRemoteBranchType]];
662+
id <PBGitRefish> refish = [self refishForSender:sender refishTypes:@[kGitXCommitType]];
663+
if (!refish || ![refish isKindOfClass:[PBGitCommit class]])
664+
return;
665+
663666
NSError *error = nil;
664667
BOOL success = [self.repository rebaseBranch:nil onRefish:refish error:&error];
665668
if (!success) {

Classes/git/PBGitRepository.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,7 @@ - (BOOL) cherryPickRefish:(id <PBGitRefish>)ref error:(NSError **)error
893893

894894
- (BOOL) rebaseBranch:(id <PBGitRefish>)branch onRefish:(id <PBGitRefish>)upstream error:(NSError **)error
895895
{
896-
if (!upstream)
897-
return NO;
896+
NSParameterAssert(upstream != nil);
898897

899898
NSArray *arguments = @[@"rebase", upstream.refishName];
900899

0 commit comments

Comments
 (0)