perf: use git tag --merge <branch> to filter tags present in a branch history
BREAKING CHANGE: Git CLI version 2.7.1 or higher is now required The `--merge` option of the `git tag` command has been added in Git version 2.7.1 and is now used by semantic-release
This commit is contained in:
+4
-3
@@ -22,15 +22,16 @@ async function getTagHead(tagName, execaOpts) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all the repository tags.
|
||||
* Get all the tags for a given branch.
|
||||
*
|
||||
* @param {String} branch The branch for which to retrieve the tags.
|
||||
* @param {Object} [execaOpts] Options to pass to `execa`.
|
||||
*
|
||||
* @return {Array<String>} List of git tags.
|
||||
* @throws {Error} If the `git` command fails.
|
||||
*/
|
||||
async function getTags(execaOpts) {
|
||||
return (await execa('git', ['tag'], execaOpts)).stdout
|
||||
async function getTags(branch, execaOpts) {
|
||||
return (await execa('git', ['tag', '--merged', branch], execaOpts)).stdout
|
||||
.split('\n')
|
||||
.map(tag => tag.trim())
|
||||
.filter(Boolean);
|
||||
|
||||
Reference in New Issue
Block a user