mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 16:38:50 +02:00
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:
parent
251ec17ed9
commit
b281d1d76c
3 changed files with 53 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue