libgit2

git_message_prettify

Version:

Clean up message from excess whitespace and make sure that the last line ends with a '\n '.

Optionally, can remove lines starting with a "#".

Signature

int git_message_prettify(char *out, size_t out_size, const char *message, int strip_comments);

Parameters

char *
In
out

The user-allocated buffer which will be filled with the cleaned up message. Pass NULL if you just want to get the needed size of the prettified message as the output value.

size_t
In
out_size

Size of the out buffer in bytes.

const char *
In
message

The message to be prettified.

int
In
strip_comments

Non-zero to remove lines starting with "#", 0 to leave them in.

Returns

int

-1 on error, else number of characters in prettified message including the trailing NUL byte

Versions