From 074841ec6ae2cc70391544ea76082bc4e2c4a1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 1 Aug 2012 17:49:19 +0200 Subject: repository: add a getter and remove function for git's prepared message The 'git revert/cherry-pick/merge -n' commands leave .git/MERGE_MSG behind so that git-commit can find it. As we don't yet support these operations, users who are shelling out to let git perform these operations haven't had a convenient way to get this message. These functions allow the user to retrieve the message and remove it when she's created the commit. --- include/git2/repository.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'include/git2') diff --git a/include/git2/repository.h b/include/git2/repository.h index ef2f5413..e727ff31 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -315,6 +315,28 @@ GIT_EXTERN(int) git_repository_index(git_index **out, git_repository *repo); */ GIT_EXTERN(void) git_repository_set_index(git_repository *repo, git_index *index); +/** + * Retrive git's prepared message + * + * Operations such as git revert/cherry-pick/merge with the -n option + * stop just short of creating a commit with the changes and save + * their prepared message in .git/MERGE_MSG so the next git-commit + * execution can present it to the user for them to amend if they + * wish. + * + * Use this function to get the contents of this file. Don't forget to + * remove the file after you create the commit. + */ +GIT_EXTERN(int) git_repository_message(char *buffer, size_t len, git_repository *repo); + +/** + * Remove git's prepared message. + * + * Remove the message that `git_repository_message` retrieves. + */ +GIT_EXTERN(int) git_repository_message_remove(git_repository *repo); + + /** @} */ GIT_END_DECL #endif -- cgit v1.2.1