vendor/libgit2/include/git2/message.h in rugged-0.26.7 vs vendor/libgit2/include/git2/message.h in rugged-0.27.0

- old
+ new

@@ -17,14 +17,13 @@ * @{ */ GIT_BEGIN_DECL /** - * Clean up message from excess whitespace and make sure that the last line - * ends with a '\n'. + * Clean up excess whitespace and make sure there is a trailing newline in the message. * - * Optionally, can remove lines starting with a "#". + * Optionally, it can remove lines which start with the comment character. * * @param out The user-allocated git_buf which will be filled with the * cleaned up message. * * @param message The message to be prettified. @@ -35,9 +34,50 @@ * are considered to be comments and removed if `strip_comments` is non-zero. * * @return 0 or an error code. */ GIT_EXTERN(int) git_message_prettify(git_buf *out, const char *message, int strip_comments, char comment_char); + +/** + * Represents a single git message trailer. + */ +typedef struct { + const char *key; + const char *value; +} git_message_trailer; + +/** + * Represents an array of git message trailers. + * + * Struct members under the private comment are private, subject to change + * and should not be used by callers. + */ +typedef struct { + git_message_trailer *trailers; + size_t count; + + /* private */ + char *_trailer_block; +} git_message_trailer_array; + +/** + * Parse trailers out of a message, filling the array pointed to by +arr+. + * + * Trailers are key/value pairs in the last paragraph of a message, not + * including any patches or conflicts that may be present. + * + * @param arr A pre-allocated git_message_trailer_array struct to be filled in + * with any trailers found during parsing. + * @param message The message to be parsed + * @return 0 on success, or non-zero on error. + */ +GIT_EXTERN(int) git_message_trailers(git_message_trailer_array *arr, const char *message); + +/** + * Clean's up any allocated memory in the git_message_trailer_array filled by + * a call to git_message_trailers. + */ +GIT_EXTERN(void) git_message_trailer_array_free(git_message_trailer_array *arr); /** @} */ GIT_END_DECL #endif /* INCLUDE_git_message_h__ */