summaryrefslogtreecommitdiff
path: root/src/pack-objects.c
diff options
context:
space:
mode:
authorXavier L <xavier.l@afrosoft.ca>2013-04-23 12:22:29 -0400
committerXavier L <xavier.l@afrosoft.ca>2013-04-23 12:22:29 -0400
commitf0e37a8b863c2e6caba2b15e4d723bddfe74b46c (patch)
tree6c9f2fbb91205fd0ddf3e59a111c2d1ed8f0a388 /src/pack-objects.c
parent6c1b6b7abcef75d421e4d59c397eff54cc1f28aa (diff)
downloadlibgit2-f0e37a8b863c2e6caba2b15e4d723bddfe74b46c.tar.gz
Added function to insert commit into pack
Diffstat (limited to 'src/pack-objects.c')
-rw-r--r--src/pack-objects.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/pack-objects.c b/src/pack-objects.c
index 459201f58..56240125b 100644
--- a/src/pack-objects.c
+++ b/src/pack-objects.c
@@ -1284,6 +1284,21 @@ static int cb_tree_walk(const char *root, const git_tree_entry *entry, void *pay
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)
{
git_tree *tree;