目前,我使用以下命令列出git树上的文件:
repository
.getBranchCommit(treeRefName)
.then((commit)=> commit.getTree())
.then((tree) => {
obj.repositoryTree = tree;
obj.repositoryTreeEntries = tree.entries();
fullfill(obj);
})
.catch(reject);
并进一步列出使用oid方法的OID
。进一步尝试使用以下命令获取提交消息:
Git.Commit
.lookup(repository, oid)
.then((commit) => {
console.log(commit.message());
})
.then(() => fullfill(obj))
.catch(reject);
正如在lookup方法中提到的。问题是它一直在崩溃。此外,在一个来自终端的简单git log
中显示,oid
与提交散列不同。我到底在哪里出错了,去获取修改文件的最后一次提交?
发布于 2018-03-27 16:48:34
RevWalk
的fileHistoryWalk
函数应该可以帮助您实现这一点,但它有点违反直觉。
https://stackoverflow.com/questions/49489183
复制相似问题