hlibgit2 0.17.0.5 → 0.17.0.6
raw patch · 5 files changed
+63/−11 lines, 5 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Bindings.Libgit2.Commit: c'git_commit_create_oid :: Ptr C'git_oid -> Ptr C'git_repository -> CString -> Ptr C'git_signature -> Ptr C'git_signature -> CString -> CString -> Ptr C'git_oid -> CInt -> Ptr (Ptr C'git_oid) -> IO (CInt)
+ Bindings.Libgit2.Commit: p'git_commit_create_oid :: FunPtr (Ptr C'git_oid -> Ptr C'git_repository -> CString -> Ptr C'git_signature -> Ptr C'git_signature -> CString -> CString -> Ptr C'git_oid -> CInt -> Ptr (Ptr C'git_oid) -> IO (CInt))
+ Bindings.Libgit2.Repository: c'git_repository_new :: Ptr (Ptr C'git_repository) -> IO (CInt)
+ Bindings.Libgit2.Repository: p'git_repository_new :: FunPtr (Ptr (Ptr C'git_repository) -> IO (CInt))
Files
- Bindings/Libgit2/Commit.hsc +1/−0
- Bindings/Libgit2/Repository.hsc +1/−0
- hlibgit2.cabal +1/−1
- libgit2/include/git2/commit.h +20/−0
- libgit2/src/commit.c +40/−10
Bindings/Libgit2/Commit.hsc view
@@ -23,3 +23,4 @@ #ccall git_commit_parent , Ptr (Ptr <git_commit>) -> Ptr <git_commit> -> CUInt -> IO (CInt) #ccall git_commit_parent_oid , Ptr <git_commit> -> CUInt -> IO (Ptr <git_oid>) #ccall git_commit_create , Ptr <git_oid> -> Ptr <git_repository> -> CString -> Ptr <git_signature> -> Ptr <git_signature> -> CString -> CString -> Ptr <git_tree> -> CInt -> Ptr (Ptr <git_commit>) -> IO (CInt)+#ccall git_commit_create_oid , Ptr <git_oid> -> Ptr <git_repository> -> CString -> Ptr <git_signature> -> Ptr <git_signature> -> CString -> CString -> Ptr <git_oid> -> CInt -> Ptr (Ptr <git_oid>) -> IO (CInt)
Bindings/Libgit2/Repository.hsc view
@@ -15,6 +15,7 @@ #num GIT_REPOSITORY_OPEN_NO_SEARCH #num GIT_REPOSITORY_OPEN_CROSS_FS #ccall git_repository_open_ext , Ptr (Ptr <git_repository>) -> CString -> CUInt -> CString -> IO (CInt)+#ccall git_repository_new , Ptr (Ptr <git_repository>) -> IO (CInt) #ccall git_repository_free , Ptr <git_repository> -> IO () #ccall git_repository_init , Ptr (Ptr <git_repository>) -> CString -> CUInt -> IO (CInt) #ccall git_repository_head , Ptr (Ptr <git_reference>) -> Ptr <git_repository> -> IO (CInt)
hlibgit2.cabal view
@@ -1,5 +1,5 @@ Name: hlibgit2-Version: 0.17.0.5+Version: 0.17.0.6 Synopsis: Low-level bindings to libgit2 Description: Bindings to libgit2 v0.17.0. License-file: LICENSE
libgit2/include/git2/commit.h view
@@ -265,6 +265,26 @@ int parent_count, ...); +/**+ * Create a new commit in the repository, as with `git_commit_create`,+ * using `git_oid` instances as parameters instead of `git_object`.+ *+ * See documentation for `git_commit_create` for information about the+ * parameters, as the meaning is identical excepting that `tree` and+ * `parents` now take `git_oid`.+ */+GIT_EXTERN(int) git_commit_create_oid(+ git_oid *oid,+ git_repository *repo,+ const char *update_ref,+ const git_signature *author,+ const git_signature *committer,+ const char *message_encoding,+ const char *message,+ const git_oid *tree,+ int parent_count,+ const git_oid *parents[]);+ /** @} */ GIT_END_DECL #endif
libgit2/src/commit.c view
@@ -150,7 +150,7 @@ return res; } -int git_commit_create(+int git_commit_create_oid( git_oid *oid, git_repository *repo, const char *update_ref,@@ -158,22 +158,18 @@ const git_signature *committer, const char *message_encoding, const char *message,- const git_tree *tree,+ const git_oid *tree, int parent_count,- const git_commit *parents[])+ const git_oid *parents[]) { git_buf commit = GIT_BUF_INIT, cleaned_message = GIT_BUF_INIT; int i; git_odb *odb; - assert(git_object_owner((const git_object *)tree) == repo);-- git_oid__writebuf(&commit, "tree ", git_object_id((const git_object *)tree));+ git_oid__writebuf(&commit, "tree ", tree); - for (i = 0; i < parent_count; ++i) {- assert(git_object_owner((const git_object *)parents[i]) == repo);- git_oid__writebuf(&commit, "parent ", git_object_id((const git_object *)parents[i]));- }+ for (i = 0; i < parent_count; ++i)+ git_oid__writebuf(&commit, "parent ", parents[i]); git_signature__writebuf(&commit, "author ", author); git_signature__writebuf(&commit, "committer ", committer);@@ -210,6 +206,40 @@ git_buf_free(&cleaned_message); giterr_set(GITERR_OBJECT, "Failed to create commit."); return -1;+}++int git_commit_create(+ git_oid *oid,+ git_repository *repo,+ const char *update_ref,+ const git_signature *author,+ const git_signature *committer,+ const char *message_encoding,+ const char *message,+ const git_tree *tree,+ int parent_count,+ const git_commit *parents[])+{+ int retval, i;+ const git_oid **parent_oids;++ assert(git_object_owner((const git_object *)tree) == repo);++ parent_oids = git__malloc(parent_count * sizeof(git_oid *));+ GITERR_CHECK_ALLOC(parent_oids);++ for (i = 0; i < parent_count; ++i) {+ assert(git_object_owner((const git_object *)parents[i]) == repo);+ parent_oids[i] = git_object_id((const git_object *)parents[i]);+ }++ retval = git_commit_create_oid(oid, repo, update_ref, author, committer,+ message_encoding, message,+ git_object_id((const git_object *)tree),+ parent_count, parent_oids);++ git__free((void *)parent_oids);+ return retval; } int git_commit__parse_buffer(git_commit *commit, const void *data, size_t len)