【发布时间】:2018-01-19 19:24:59
【问题描述】:
如何使用 nodegit 获取两个标签之间的差异?
在命令行上,I can see the diff between two tags, no problemo。
另外,我可以使用 nodegit 列出我的 repo 中的标签:
const Git = require('nodegit')
const path = require('path')
Git.Repository.open(path.resolve(__dirname, '.git'))
.then((repo) => {
console.log('Opened repo ...')
Git.Tag.list(repo).then((array) => {
console.log('Tags:')
console.log(array)
})
})
但是,我不确定如何在 nodegit 中找到两个标签之间的差异。
我试过了,但Diff 部分没有打印任何内容:
const Git = require('nodegit')
const path = require('path')
Git.Repository.open(path.resolve(__dirname, '.git'))
.then((repo) => {
console.log('Opened repo ...')
Git.Tag.list(repo).then((array) => {
console.log('Tags:')
console.log(array)
Git.Diff(array[0], array[1]).then((r) => {
console.log('r', r)
})
})
})
【问题讨论】: