Tag: git log

使用libgit2的“git log -1 fullpath / myfile”

我想用libgit2实现git log -1 fullpath/myfile 。 我是libgit2的新手。 我是在正确的轨道上吗? 这是我到目前为止: git_repository_head(&refToHead, repo); headOID = git_reference_oid(refToHead); git_commit_lookup(&headCommit, repo, headOID); headTreeOID = git_commit_tree_oid(headCommit); git_tree_lookup(&tree, repo, headTreeOID); git_tree_entry_byname(tree, “repopath/myfile”); 不幸的是, git_tree_entry_byname似乎不适用于repo的子目录中的文件。 任何的想法? 谢谢你,拉尔斯