From ea85d0ce729e907f85d46908b1ebc05ab2cd4c0f Mon Sep 17 00:00:00 2001 From: "Babak K. Shandiz" Date: Thu, 12 Jan 2023 16:22:34 +0330 Subject: [PATCH] =?UTF-8?q?=F0=9F=96=8A=20Include=20branch=20name=20in=20c?= =?UTF-8?q?ommit=20button=20popup=20(#167827)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🖊 Include branch name in commit button popup Signed-off-by: Babak K. Shandiz * 🖊 Include branch name in "Publish" button popup Signed-off-by: Babak K. Shandiz Signed-off-by: Babak K. Shandiz --- extensions/git/src/actionButton.ts | 8 ++++++-- extensions/git/src/postCommitCommands.ts | 9 ++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/extensions/git/src/actionButton.ts b/extensions/git/src/actionButton.ts index 65da19ae06f..4cd6bced2df 100644 --- a/extensions/git/src/actionButton.ts +++ b/extensions/git/src/actionButton.ts @@ -146,8 +146,12 @@ export class ActionButtonCommand { command: 'git.publish', title: l10n.t({ message: '{0} Publish Branch', args: [icon], comment: ['{Locked="Branch"}', 'Do not translate "Branch" as it is a git term'] }), tooltip: this.state.isSyncInProgress ? - l10n.t({ message: 'Publishing Branch...', comment: ['{Locked="Branch"}', 'Do not translate "Branch" as it is a git term'] }) : - l10n.t({ message: 'Publish Branch', comment: ['{Locked="Branch"}', 'Do not translate "Branch" as it is a git term'] }), + (this.state.HEAD?.name ? + l10n.t({ message: 'Publishing Branch \'{0}\'...', args: [this.state.HEAD.name], comment: ['{Locked="Branch"}', 'Do not translate "Branch" as it is a git term'] }) : + l10n.t({ message: 'Publishing Branch...', comment: ['{Locked="Branch"}', 'Do not translate "Branch" as it is a git term'] })) : + (this.repository.HEAD?.name ? + l10n.t({ message: 'Publish Branch \'{0}\'', args: [this.state.HEAD?.name], comment: ['{Locked="Branch"}', 'Do not translate "Branch" as it is a git term'] }) : + l10n.t({ message: 'Publish Branch', comment: ['{Locked="Branch"}', 'Do not translate "Branch" as it is a git term'] })), arguments: [this.repository.sourceControl], }, enabled: !this.state.isSyncInProgress diff --git a/extensions/git/src/postCommitCommands.ts b/extensions/git/src/postCommitCommands.ts index b7af453eaa4..0daf2b9be29 100644 --- a/extensions/git/src/postCommitCommands.ts +++ b/extensions/git/src/postCommitCommands.ts @@ -174,9 +174,12 @@ export class CommitCommandsCenter { const icon = alwaysPrompt ? '$(lock)' : alwaysCommitToNewBranch ? '$(git-branch)' : undefined; // Tooltip (default) - let tooltip = !alwaysCommitToNewBranch ? - l10n.t('Commit Changes') : - l10n.t('Commit Changes to New Branch'); + const branch = this.repository.HEAD?.name; + let tooltip = alwaysCommitToNewBranch ? + l10n.t('Commit Changes to New Branch') : + branch ? + l10n.t('Commit Changes on \'{0}\'', branch) : + l10n.t('Commit Changes'); // Tooltip (in progress) if (this.repository.operations.isRunning(OperationKind.Commit)) {