我一直在查看libgit2 C API参考,但我不知道如何模仿它的行为git commit --allow-empty.libgit2是否有内置的方法来创建空提交?如果没有,git如何在引擎盖下创建一个空提交,我应该如何使用libgit2实现相同的行为?
git_commit_create使用与父提交相同的树进行调用.那是:
// Get parent somehow.
git_commit *parent = ...;
// Use the same tree as the parent.
git_tree *tree;
git_commit_tree(&tree, parent);
// Create the commit.
git_commit_create(..., tree, 1, parent);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
154 次 |
| 最近记录: |