首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Git描述NPM不提供标签信息

Git描述NPM不提供标签信息
EN

Stack Overflow用户
提问于 2020-09-23 01:18:41
回答 1查看 297关注 0票数 0

我正在尝试Git-Describe npm包来检索散列信息和标签,以便稍后附加到我的应用程序中。

我已经遵循了Git describe npm page中提供的说明。该脚本运行良好,但此处的标记信息检索为空。另外,我在本地和我的远程git中添加了一些标签。

我能够使用git tag -l检索所有标记信息

下面是我试图运行的脚本。

代码语言:javascript
复制
const {gitDescribe, gitDescribeSync} = require('git-describe');
 
// Another example: working directory, use 16 character commit hash abbreviation
const gitInfo = gitDescribeSync({
    customArguments: ['--abbrev=16']
});
 
// Asynchronous with promise
gitDescribe(__dirname)
    .then((gitInfo) => console.dir(gitInfo))
    .catch((err) => console.error(err));
 
// Asynchronous with node-style callback
gitDescribe(__dirname, (err, gitInfo) => {
    if (err)
        return console.error(err);
    console.dir(gitInfo);
});

节点version.js

输出为:

代码语言:javascript
复制
{
  dirty: true,
  raw: 'f8f7e57e-dirty',
  hash: 'f8f7e57e',
  distance: null,
  tag: null,
  semver: null,
  suffix: 'f8f7e57e-dirty',
  semverString: null,
  toString: [Function]
}

这里的标签信息是空的。但是哈希串是正确的。(Git日志输出)。

代码语言:javascript
复制
commit **f8f7e57e**713b71b0f9d3181c0d19ffd (HEAD -> PF223095_US1834348_ui_gitcommit, tag: r9.0.6, origin/PF223095_US1834348_ui_gitcommit, mastere)
EN

回答 1

Stack Overflow用户

发布于 2021-05-22 22:33:43

默认情况下,git-describe只跟踪以v开头的版本,所以像v1.0.01.0.0这样的东西就失败了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64014694

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档