Git - Commit action button fix (#199475)

This commit is contained in:
Ladislau Szomoru 2023-11-29 02:16:59 +01:00 committed by GitHub
parent 60ff5faba4
commit aebfa4798c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -219,6 +219,16 @@ export class CommitActionButton extends AbstractActionButton {
};
}
// Not a branch (tag, detached)
if (this.state.HEAD?.type === RefType.Tag || !this.state.HEAD?.name) {
return {
command: 'git.commit',
title: l10n.t('{0} Commit', '$(check)'),
tooltip: this.state.isCommitInProgress ? l10n.t('Committing Changes...') : l10n.t('Commit Changes'),
arguments: [this.repository.sourceControl, '']
};
}
// Commit
return this.postCommitCommandCenter.getPrimaryCommand();
}
@ -229,6 +239,11 @@ export class CommitActionButton extends AbstractActionButton {
return [];
}
// Not a branch (tag, detached)
if (this.state.HEAD?.type === RefType.Tag || !this.state.HEAD?.name) {
return [];
}
// Commit
const commandGroups: Command[][] = [];
for (const commands of this.postCommitCommandCenter.getSecondaryCommands()) {