mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 04:59:07 +00:00
Added function to insert commit into pack
This commit is contained in:
parent
6c1b6b7abc
commit
f0e37a8b86
@ -94,6 +94,18 @@ GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *id, c
|
|||||||
*/
|
*/
|
||||||
GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *id);
|
GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Insert a commit object
|
||||||
|
*
|
||||||
|
* This will add a commit as well as the completed referenced tree.
|
||||||
|
*
|
||||||
|
* @param pb The packbuilder
|
||||||
|
* @param id The oid of the commit
|
||||||
|
*
|
||||||
|
* @return 0 or an error code
|
||||||
|
*/
|
||||||
|
GIT_EXTERN(int) git_packbuilder_insert_commit(git_packbuilder *pb, const git_oid *id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the new pack and the corresponding index to path
|
* Write the new pack and the corresponding index to path
|
||||||
*
|
*
|
||||||
|
@ -1284,6 +1284,21 @@ static int cb_tree_walk(const char *root, const git_tree_entry *entry, void *pay
|
|||||||
git_buf_cstr(&ctx->buf));
|
git_buf_cstr(&ctx->buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int git_packbuilder_insert_commit(git_packbuilder *pb, const git_oid *oid)
|
||||||
|
{
|
||||||
|
git_commit *commit;
|
||||||
|
|
||||||
|
if (git_commit_lookup(&commit, pb->repo, oid) < 0 ||
|
||||||
|
git_packbuilder_insert(pb, oid, NULL) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (git_packbuilder_insert_tree(pb, git_commit_tree_id(commit)) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
git_commit_free(commit);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid)
|
int git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid)
|
||||||
{
|
{
|
||||||
git_tree *tree;
|
git_tree *tree;
|
||||||
|
Loading…
Reference in New Issue
Block a user