Git - fix edge case during rebase (#156410)

Fix blocking issue while resolving conflicts during rebase
This commit is contained in:
Ladislau Szomoru
2022-07-27 11:03:47 +02:00
committed by GitHub
parent 19ac36abb6
commit e210bbfea4
2 changed files with 14 additions and 7 deletions

View File

@@ -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 {
// Rebase Continue
if (this.state.isRebaseInProgress) {
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");
// Rebase Continue
if (this.state.isRebaseInProgress) {
return { command: 'git.commit', title, tooltip, arguments: [this.repository.sourceControl, commandArg] };
}
// Commit
const config = workspace.getConfiguration('git', Uri.file(this.repository.root));
const postCommitCommand = config.get<string>('postCommitCommand');

View File

@@ -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);