2.9 Commit
(require libgit2/include/commit) | package: libgit2 |
procedure
(git_commit_amend id commit_to_amend update_ref author committer message_encoding message tree) → integer? id : oid? commit_to_amend : commit? update_ref : (or/c string? #f) author : (or/c signature? #f) committer : (or/c signature? #f) message_encoding : (or/c string? #f) message : (or/c string? #f) tree : (or/c tree? #f)
This creates a new commit that is exactly the same as the old commit, except that any non-NULL values will be updated. The new commit has the same parents as the old commit.
The update_ref value works as in the regular git_commit_create(), updating the ref to point to the newly rewritten commit. If you want to amend a commit that is not currently the tip of the branch and then rewrite the following commits to reach a ref, pass this as NULL and update the rest of the commit chain and ref separately.
Unlike git_commit_create(), the author, committer, message, message_encoding, and tree parameters can be NULL in which case this will use the values from the original commit_to_amend.
All parameters have the same meanings as in git_commit_create().
procedure
(git_commit_body commit) → string?
commit : commit?
The returned message is the body of the commit, comprising everything but the first paragraph of the message. Leading and trailing whitespaces are trimmed.
procedure
(git_commit_create id repo update_ref author committer message_encoding message tree parent_count parents) → integer? id : oid? repo : repository? update_ref : (or/c string? #f) author : signature? committer : signature? message_encoding : (or/c string? #f) message : string? tree : tree? parent_count : exact-positive-integer? parents : (or/c (cpointer commit) #f)
The message will not be cleaned up automatically. You can do that with the git_message_prettify() function.
procedure
(git_commit_create_buffer out repo author committer message_encoding message tree parent_count parents) → integer? out : buf? repo : repository? author : signature? committer : signature? message_encoding : (or/c string? #f) message : string? tree : tree? parent_count : exact-positive-integer? parents : (or/c (cpointer commit) #f)
Create a commit as with git_commit_create() but instead of writing it to the objectdb, write the contents of the object into a buffer.
procedure
(git_commit_create_from_callback id repo update_ref author committer message_encoding message tree parent_cb parent_payload) → integer? id : oid? repo : repository? update_ref : (or/c string? #f) author : signature? committer : signature? message_encoding : (or/c string? #f) message : string? tree : oid? parent_cb : git_commit_parent_callback parent_payload : (or/c (cpointer void) #f)
See documentation for git_commit_create() for information about the parameters, as the meaning is identical excepting that tree takes a git_oid and doesn’t check for validity, and parent_cb is invoked with parent_payload and should return git_oid values or NULL to indicate that all parents are accounted for.
procedure
(git_commit_create_from_ids id repo update_ref author committer message_encoding message tree parent_count parents) → integer? id : oid? repo : repository? update_ref : (or/c string? #f) author : signature? committer : signature? message_encoding : (or/c string? #f) message : string? tree : oid? parent_count : size_t parents : (cpointer oid)
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. This is a dangerous API in that nor the tree, neither the parents list of git_oids are checked for validity.
procedure
(git_commit_create_v id repo update_ref author committer message_encoding message tree parent_count) → integer? id : oid? repo : repository? update_ref : (or/c string? #f) author : signature? committer : signature? message_encoding : (or/c string? #f) message : string? tree : tree? parent_count : exact-positive-integer?
The message will not be cleaned up automatically. You can do that with the git_message_prettify() function.
The parents for the commit are specified as a variable list of pointers to const git_commit *. Note that this is a convenience method which may not be safe to export for certain languages or compilers
All other parameters remain the same as git_commit_create().
procedure
(git_commit_create_with_signature out repo commit_content signature signature_field) → integer? out : oid? repo : repository? commit_content : string? signature : string? signature_field : (or/c string? #f)
Given the unsigned commit object’s contents, its signature and the header field in which to store the signature, attach the signature to the commit and write it into the given repository.
’signature_field’ defaults to "gpgsig"
procedure
(git_commit_extract_signature signature signed_data repo commit_id field) → integer? signature : buf? signed_data : buf? repo : repository? commit_id : oid? field : (or/c string? #f)
If the id is not for a commit, the error class will be GITERR_INVALID. If the commit does not have a signature, the error class will be GITERR_OBJECT.
’field’ defaults to "gpgsig"
procedure
(git_commit_free commit) → void?
commit : commit?
This is a wrapper around git_object_free()
IMPORTANT: It is necessary to call this method when you stop using a commit. Failure to do so will cause a memory leak.
procedure
(git_commit_header_field out commit field) → integer?
out : buf? commit : commit? field : string?
The returned object should be released with git_commit_free when no longer needed.
procedure
repo : repository? id : oid? len : exact-positive-integer?
The returned object should be released with git_commit_free when no longer needed.
procedure
(git_commit_message commit) → string?
commit : commit?
The returned message will be slightly prettified by removing any potential leading newlines.
procedure
(git_commit_message_encoding commit) → string?
commit : commit?
The encoding may be NULL if the encoding header in the commit is missing; in that case UTF-8 is assumed.
procedure
(git_commit_message_raw commit) → bytes?
commit : commit?
th generation ancestor of the named commit object, following only the first parents. The returned commit has to be freed by the caller.
Passing 0 as the generation number returns another instance of the base commit itself.
procedure
(git_commit_parentcount commit) → integer?
commit : commit?
procedure
(git_commit_raw_header commit) → string?
commit : commit?
procedure
(git_commit_summary commit) → string?
commit : commit?
The returned message is the summary of the commit, comprising the first paragraph of the message with whitespace trimmed and squashed.
procedure
(git_commit_time_offset commit) → integer?
commit : commit?