diff options
-rw-r--r-- | git.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -180,6 +180,30 @@ int create_info_file(pull_request *pr, const char *pr_root) { return 1; } +int get_comment_len(comment *comment) { + struct tm tm; + int len = format_len("title: %s\n", pr->title); + + localtime_r(&comment->date, &tm); + + len = format_len("id: %i\n", comment->id); + len += format_len("author: %s\n", comment->author); + len += format_len("date: ") + strftime(NULL, -1, "%c %z\n", &tm); + + /* Is this comment a reply? */ + if (comment->reply != NULL) { + localtime_r(&comment->reply->date, &tm); + len += format_len("reply-to: %i\n", comment->reply->id); + len += format_len("reply-author: %s\n", comment->reply->author); + len += format_len("reply-date: ") + strftime(NULL, -1, "%c %z\n", &tm); + } + + len += format_len("description: %s\n\n", comment->desc); + + return len; + +} + int add_comment(comment *comment, const char *pr_root) { int len; int buf_len; |