diff options
author | Vicent Marti <tanoku@gmail.com> | 2014-06-20 14:42:16 +0200 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2014-06-20 14:42:16 +0200 |
commit | 28f087c8642ff9c8dd6964e101e6d8539db6281a (patch) | |
tree | 3518d1bf420e92c964bed03074575d8a1db88654 /include/git2/commit.h | |
parent | 4b0a36e881506a02b43a4ae3c19c93c919b36eeb (diff) | |
parent | 1589aa0c4d48fb130d8a5db28c45cd3d173cde6d (diff) | |
download | libgit2-28f087c8642ff9c8dd6964e101e6d8539db6281a.tar.gz |
libgit2 v0.21.0v0.21.0
Diffstat (limited to 'include/git2/commit.h')
-rw-r--r-- | include/git2/commit.h | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/include/git2/commit.h b/include/git2/commit.h index a08cf1c6c..fb53a701b 100644 --- a/include/git2/commit.h +++ b/include/git2/commit.h @@ -117,6 +117,17 @@ GIT_EXTERN(const char *) git_commit_message(const git_commit *commit); GIT_EXTERN(const char *) git_commit_message_raw(const git_commit *commit); /** + * Get the short "summary" of the git commit message. + * + * The returned message is the summary of the commit, comprising the + * first paragraph of the message with whitespace trimmed and squashed. + * + * @param commit a previously loaded commit. + * @return the summary of a commit or NULL on error + */ +GIT_EXTERN(const char *) git_commit_summary(git_commit *commit); + +/** * Get the commit time (i.e. committer time) of a commit. * * @param commit a previously loaded commit. @@ -231,8 +242,8 @@ GIT_EXTERN(int) git_commit_nth_gen_ancestor( /** * Create new commit in the repository from a list of `git_object` pointers * - * The message will not be cleaned up automatically. You can do that with - * the `git_message_prettify()` function. + * The message will **not** be cleaned up automatically. You can do that + * with the `git_message_prettify()` function. * * @param id Pointer in which to store the OID of the newly created commit * @@ -243,7 +254,8 @@ GIT_EXTERN(int) git_commit_nth_gen_ancestor( * is not direct, it will be resolved to a direct reference. * Use "HEAD" to update the HEAD of the current branch and * make it point to this commit. If the reference doesn't - * exist yet, it will be created. + * exist yet, it will be created. If it does exist, the first + * parent must be the tip of this branch. * * @param author Signature with author and author time of commit * @@ -280,20 +292,20 @@ GIT_EXTERN(int) git_commit_create( const char *message_encoding, const char *message, const git_tree *tree, - int parent_count, + size_t parent_count, const git_commit *parents[]); /** * Create new commit in the repository using a variable argument list. * - * The message will be cleaned up from excess whitespace and it will be made - * sure that the last line ends with a '\n'. + * 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 at `git_commit_create()`. + * All other parameters remain the same as `git_commit_create()`. * * @see git_commit_create */ @@ -306,9 +318,40 @@ GIT_EXTERN(int) git_commit_create_v( const char *message_encoding, const char *message, const git_tree *tree, - int parent_count, + size_t parent_count, ...); +/** + * Amend an existing commit by replacing only non-NULL values. + * + * 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()`. + * + * @see git_commit_create + */ +GIT_EXTERN(int) git_commit_amend( + git_oid *id, + const git_commit *commit_to_amend, + const char *update_ref, + const git_signature *author, + const git_signature *committer, + const char *message_encoding, + const char *message, + const git_tree *tree); + /** @} */ GIT_END_DECL #endif |