Skip to content

Commit

Permalink
Git - fix edge case during rebase (#156410)
Browse files Browse the repository at this point in the history
Fix blocking issue while resolving conflicts during rebase
  • Loading branch information
lszomoru authored Jul 27, 2022
1 parent 19ac36a commit e210bbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 11 additions & 6 deletions extensions/git/src/actionButton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,26 @@ export class ActionButtonCommand {
return {
command: this.getCommitActionButtonPrimaryCommand(),
secondaryCommands: this.getCommitActionButtonSecondaryCommands(),
enabled: this.state.repositoryHasChangesToCommit && !this.state.isCommitInProgress && !this.state.isMergeInProgress
enabled: (this.state.repositoryHasChangesToCommit || this.state.isRebaseInProgress) && !this.state.isCommitInProgress && !this.state.isMergeInProgress
};
}

private getCommitActionButtonPrimaryCommand(): Command {
let commandArg = '';
let title = localize('scm button commit title', "{0} Commit", '$(check)');
let tooltip = this.state.isCommitInProgress ? localize('scm button committing tooltip', "Committing Changes...") : localize('scm button commit tooltip', "Commit Changes");

// Rebase Continue
if (this.state.isRebaseInProgress) {
return { command: 'git.commit', title, tooltip, arguments: [this.repository.sourceControl, commandArg] };
return {
command: 'git.commit',
title: localize('scm button continue title', "{0} Continue", '$(check)'),
tooltip: this.state.isCommitInProgress ? localize('scm button continuing tooltip', "Continuing Rebase...") : localize('scm button continue tooltip', "Continue Rebase"),
arguments: [this.repository.sourceControl, '']
};
}

// Commit
let commandArg = '';
let title = localize('scm button commit title', "{0} Commit", '$(check)');
let tooltip = this.state.isCommitInProgress ? localize('scm button committing tooltip', "Committing Changes...") : localize('scm button commit tooltip', "Commit Changes");

const config = workspace.getConfiguration('git', Uri.file(this.repository.root));
const postCommitCommand = config.get<string>('postCommitCommand');

Expand Down
2 changes: 2 additions & 0 deletions extensions/git/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1558,6 +1558,8 @@ export class CommandCenter {
// amend allows changing only the commit message
&& !opts.amend
&& !opts.empty
// rebase not in progress
&& repository.rebaseCommit === undefined
) {
const commitAnyway = localize('commit anyway', "Create Empty Commit");
const answer = await window.showInformationMessage(localize('no changes', "There are no changes to commit."), commitAnyway);
Expand Down

0 comments on commit e210bbf

Please sign in to comment.