Skip to content

Commit

Permalink
feat(@142vip/utils): 增加getTagsInHead方法获取当前提交头的所有标签
Browse files Browse the repository at this point in the history
  • Loading branch information
mmdapl committed Feb 10, 2025
1 parent ad74483 commit 73c64ca
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/utils/src/core/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ function getTags(): string[] {
return tagStr.split('\n').reverse()
}

/**
* 获取指向当前提交(HEAD)的所有标签
*/
function getTagsInHead(): string[] {
const tagStrInHead = VipExecutor.execCommandSync('git tag --points-at HEAD')
return tagStrInHead.split('\n').reverse()
}

/**
* 获取最近一次tag标签
*/
Expand Down Expand Up @@ -128,6 +136,7 @@ export const VipGit = {
getCurrentBranch,
isRepoShallow,
getTags,
getTagsInHead,
getLastMatchingTag,
isPrerelease,
execCommit,
Expand Down

0 comments on commit 73c64ca

Please sign in to comment.