Change:
Testing [ ] Update label accordingly (deferred) [x] Remove secondary actions
Pushing this out to the next milestone as there are some things I need to investigate first related to the rebase flow.
Decided to keep the "Commit" label for the button to keep things simple. Will change it if needed, based on customer feedback.

Discussion:
readonly HEAD: Branch | undefined; readonly isCommitInProgress: boolean; readonly isMergeInProgress: boolean; <ins> readonly isRebaseInProgress: boolean; </ins> readonly isSyncInProgress: boolean; readonly repositoryHasChangesToCommit: boolean; }

HEAD: undefined, isCommitInProgress: false, isMergeInProgress: false, <ins> isRebaseInProgress: false, </ins> isSyncInProgress: false, repositoryHasChangesToCommit: false };

} get button(): SourceControlActionButton | undefined { <del> if (!this.state.HEAD || !this.state.HEAD.name) { return undefined; } </del> <ins> if (!this.state.HEAD) { return undefined; } </ins> let actionButton: SourceControlActionButton | undefined;

// The button is disabled if (!showActionButton.commit) { return undefined; } <del> let title: string, tooltip: string, commandArg: string; </del> <ins> return { command: this.getCommitActionButtonPrimaryCommand(), secondaryCommands: this.getCommitActionButtonSecondaryCommands(), enabled: this.state.repositoryHasChangesToCommit && !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] }; } // Commit const config = workspace.getConfiguration('git', Uri.file(this.repository.root)); </ins> const postCommitCommand = config.get<string>('postCommitCommand'); // Branch protection

break; } default: { <del> commandArg = ''; title = localize('scm button commit title', "{0} Commit", icon ?? '$(check)'); </del> if (alwaysCommitToNewBranch) { tooltip = this.state.isCommitInProgress ? localize('scm button committing to new branch tooltip', "Committing Changes to New Branch...") : localize('scm button commit to new branch tooltip', "Commit Changes to New Branch"); <del> } else { tooltip = this.state.isCommitInProgress ? localize('scm button committing tooltip', "Committing Changes...") : localize('scm button commit tooltip', "Commit Changes"); </del> } break; } } <del> return { command: { command: 'git.commit', title: title, tooltip: tooltip, arguments: [this.repository.sourceControl, commandArg], }, secondaryCommands: this.getCommitActionButtonSecondaryCommands(), enabled: this.state.repositoryHasChangesToCommit && !this.state.isCommitInProgress && !this.state.isMergeInProgress }; </del> <ins> return { command: 'git.commit', title, tooltip, arguments: [this.repository.sourceControl, commandArg] }; </ins> } private getCommitActionButtonSecondaryCommands(): Command[][] { const commandGroups: Command[][] = []; <del> for (const provider of this.postCommitCommandsProviderRegistry.getPostCommitCommandsProviders()) { const commands = provider.getCommands(new ApiRepository(this.repository)); commandGroups.push((commands ?? []).map(c => { return { command: 'git.commit', title: c.title, arguments: [this.repository.sourceControl, c.command] }; })); } </del> <ins> if (!this.state.isRebaseInProgress) { for (const provider of this.postCommitCommandsProviderRegistry.getPostCommitCommandsProviders()) { const commands = provider.getCommands(new ApiRepository(this.repository)); commandGroups.push((commands ?? []).map(c => { return { command: 'git.commit', title: c.title, arguments: [this.repository.sourceControl, c.command] }; })); } </ins> <del> if (commandGroups.length > 0) { commandGroups[0].splice(0, 0, { command: 'git.commit', title: localize('scm secondary button commit', "Commit") }); </del> <ins> if (commandGroups.length > 0) { commandGroups[0].splice(0, 0, { command: 'git.commit', title: localize('scm secondary button commit', "Commit") }); } </ins> } return commandGroups;

const config = workspace.getConfiguration('git', Uri.file(this.repository.root)); const showActionButton = config.get<{ publish: boolean }>('showActionButton', { publish: true }); <del> // Branch does have an upstream, commit/merge is in progress, or the button is disabled if (this.state.HEAD?.upstream || this.state.isCommitInProgress || this.state.isMergeInProgress || !showActionButton.publish) { return undefined; } </del> <ins> // Branch does have an upstream, commit/merge/rebase is in progress, or the button is disabled if (this.state.HEAD?.upstream || this.state.isCommitInProgress || this.state.isMergeInProgress || this.state.isRebaseInProgress || !showActionButton.publish) { return undefined; } </ins> return { command: {

const showActionButton = config.get<{ sync: boolean }>('showActionButton', { sync: true }); const branchIsAheadOrBehind = (this.state.HEAD?.behind ?? 0) > 0 || (this.state.HEAD?.ahead ?? 0) > 0; <del> // Branch does not have an upstream, branch is not ahead/behind the remote branch, commit/merge is in progress, or the button is disabled if (!this.state.HEAD?.upstream || !branchIsAheadOrBehind || this.state.isCommitInProgress || this.state.isMergeInProgress || !showActionButton.sync) { return undefined; } </del> <ins> // Branch does not have an upstream, branch is not ahead/behind the remote branch, commit/merge/rebase is in progress, or the button is disabled if (!this.state.HEAD?.upstream || !branchIsAheadOrBehind || this.state.isCommitInProgress || this.state.isMergeInProgress || this.state.isRebaseInProgress || !showActionButton.sync) { return undefined; } </ins> const ahead = this.state.HEAD.ahead ? ` ${this.state.HEAD.ahead}$(arrow-up)` : ''; const behind = this.state.HEAD.behind ? ` ${this.state.HEAD.behind}$(arrow-down)` : '';

private onDidChangeOperations(): void { const isCommitInProgress = <del> this.repository.operations.isRunning(Operation.Commit); </del> <ins> this.repository.operations.isRunning(Operation.Commit) || this.repository.operations.isRunning(Operation.RebaseContinue); </ins> const isSyncInProgress = this.repository.operations.isRunning(Operation.Sync) ||

...this.state, HEAD: this.repository.HEAD, isMergeInProgress: this.repository.mergeGroup.resourceStates.length !== 0, <ins> isRebaseInProgress: !!this.repository.rebaseCommit, </ins> repositoryHasChangesToCommit: this.repositoryHasChangesToCommit() }; }