summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/git2/message.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/git2/message.h b/include/git2/message.h
index d78b1dce5..85fbf5676 100644
--- a/include/git2/message.h
+++ b/include/git2/message.h
@@ -38,6 +38,29 @@ GIT_BEGIN_DECL
*/
GIT_EXTERN(int) git_message_prettify(git_buf *out, const char *message, int strip_comments, char comment_char);
+typedef int(*git_message_trailer_cb)(const char *key, const char *value, void *payload);
+
+/**
+ * Parse trailers out of a message, calling a callback once for each trailer.
+ *
+ * Return non-zero from the callback to stop processing.
+ *
+ * Trailers are key/value pairs in the last paragraph of a message, not
+ * including any patches or conflicts that may be present.
+ *
+ * @param message The message to be parsed
+ *
+ * @param cb The callback to call for each trailer found in the message. The
+ * key and value arguments are pointers to NUL-terminated C strings. These
+ * pointers are only guaranteed to be valid until the callback returns.
+ * User code must make a copy of this data should it need to be retained
+ *
+ * @param payload Pointer to callback data (optional)
+ *
+ * @return 0 on success, or non-zero callback return value.
+ */
+GIT_EXTERN(int) git_message_trailers(const char *message, git_message_trailer_cb cb, void *payload);
+
/** @} */
GIT_END_DECL