Skip to content

Commit

Permalink
Made the rebase only also perform a force push if appropriately
Browse files Browse the repository at this point in the history
  • Loading branch information
glennawatson committed Aug 16, 2016
1 parent 1242e8a commit 7dc9a51
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -442,9 +442,33 @@ private async Task<GitCommandResponse> PerformSquash(CancellationToken token)
return new GitCommandResponse(true, sb.ToString());
}

private Task<GitCommandResponse> PerformRebase(CancellationToken token)
private async Task<GitCommandResponse> PerformRebase(CancellationToken token)
{
return this.SquashWrapper.Rebase(token, this.SelectedRebaseBranch);
var rebaseOutput = await this.SquashWrapper.Rebase(token, this.SelectedRebaseBranch);

GitCommandResponse forcePushOutput = null;
if (this.ForcePush)
{
forcePushOutput = await this.SquashWrapper.PushForce(token);

if (forcePushOutput.Success == false || token.IsCancellationRequested)
{
return forcePushOutput;
}
}

StringBuilder sb = new StringBuilder();
if (rebaseOutput != null && rebaseOutput.Success)
{
sb.AppendLine(rebaseOutput.CommandOutput);
}

if (forcePushOutput != null && forcePushOutput.Success)
{
sb.AppendLine(forcePushOutput.CommandOutput);
}

return new GitCommandResponse(true, sb.ToString());
}

private Task<GitCommandResponse> PerformAbortRebase(CancellationToken token)
Expand Down

0 comments on commit 7dc9a51

Please sign in to comment.