Added support for git tag -d <tag> and fixed a bug where a duplicate tag name wouldn't show in the error-msg

This commit is contained in:
Lukas Schmid 2019-09-04 16:47:24 +02:00
parent 251ec17ed9
commit b281d1d76c
3 changed files with 53 additions and 1 deletions

View file

@ -811,8 +811,41 @@ var commandConfig = {
tag: {
regex: /^git +tag($|\s)/,
options: [
'-d'
],
execute: function(engine, command) {
var generalArgs = command.getGeneralArgs();
var commandOptions = command.getOptionsMap();
if (commandOptions['-d']) {
var tagID = commandOptions['-d'];
var tagToRemove;
assertIsRef(engine, tagID);
command.oneArgImpliedHead(tagID);
engine.tagCollection.each(function(tag) {
if(tag.get('id') == tagID){
tagToRemove = tag;
}
}, true);
if(tagToRemove == undefined){
throw new GitError({
msg: intl.todo(
'No tag found, nothing to remove'
)
});
}
engine.tagCollection.remove(tagToRemove);
delete engine.refs[tagID];
engine.gitVisuals.refreshTree();
return;
}
if (generalArgs.length === 0) {
var tags = engine.getTags();
engine.printTags(tags);