来自git_diff指针的Libgit2文件内容
我在我的项目中使用libgit2,我想获得两次提交之间的文件列表及其内容来自git_diff指针的Libgit2文件内容,git,libgit2,Git,Libgit2,我在我的项目中使用libgit2,我想获得两次提交之间的文件列表及其内容 // ID of the selected trees from two commits & trees themselves git_oid pre_tree_id, post_tree_id git_tree *pre_tree, *post_tree; // Here I get the trees git_tree_lookup(&pre_tree, repo, &pre_tree_id)
// ID of the selected trees from two commits & trees themselves
git_oid pre_tree_id, post_tree_id
git_tree *pre_tree, *post_tree;
// Here I get the trees
git_tree_lookup(&pre_tree, repo, &pre_tree_id);
git_tree_lookup(&post_tree, repo, &post_tree_id);
// Now I get differences between the trees
git_diff_tree_to_tree(&diff, repo, pre_tree, post_tree, NULL);
我得到git_diff对象,我需要在这两个提交中迭代并重新创建文件内容
你知道我该怎么做吗