From 705cd82152b3228cb5162c8e5680b77074bdac91 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Mon, 1 Aug 2022 11:11:49 -0300 Subject: git: Add `parse_remote_branch()` callback This needs to be done in order to properly allocate the remote branch before setting it's members. --- git.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'git.h') diff --git a/git.h b/git.h index b8a709d..71cecd0 100644 --- a/git.h +++ b/git.h @@ -57,6 +57,7 @@ extern pull_request *get_pull_request(index_t *idx, const char *root, const char extern int add_comment(comment *comment, const char *pr_root); extern int create_pull_request_dir(pull_request *pr, index_t *idx, const char *root, const char *repo); +int parse_remote_branch(void *ctx, void *ret, const keyword *key, keyword_val val); int parse_patch_list(void *ctx, void *ret, const keyword *key, keyword_val val); int parse_comment_reply(void *ctx, void *ret, const keyword *key, keyword_val val); @@ -67,8 +68,8 @@ static const keyword *info_keywords[] = { &(const keyword){"date", "Date of Pull Request's creation.", "%a %b %e %H:%M:%S %Y %z", TYPE_TIME, offset_list(offsetof(pull_request, date)), NULL}, &(const keyword){"description", "Description of Pull Request.", NULL, TYPE_STRING, offset_list(offsetof(pull_request, desc)), NULL}, &(const keyword){"type", "Type of Pull Request (0 = patch files, 1 = remote repo).", NULL, TYPE_INT, offset_list(offsetof(pull_request, pr_type)), NULL}, - &(const keyword){"branch", "Branch of remote repo.", NULL, TYPE_STRING, offset_list(offsetof(pull_request, branch), offsetof(git_branch, name)), NULL}, - &(const keyword){"repo", "URL of remote repo.", NULL, TYPE_STRING, offset_list(offsetof(pull_request, branch), offsetof(git_branch, repo)), NULL}, + &(const keyword){"branch", "Branch of remote repo.", NULL, TYPE_STRING, offset_list(offsetof(pull_request, branch), offsetof(git_branch, name)), parse_remote_branch}, + &(const keyword){"repo", "URL of remote repo.", NULL, TYPE_STRING, offset_list(offsetof(pull_request, branch), offsetof(git_branch, repo)), parse_remote_branch}, &(const keyword){"patches", "Patch file(s) of Pull Request.", NULL, TYPE_STRING, offset_list(offsetof(pull_request, patches), offsetof(file, name)), parse_patch_list}, NULL, }; -- cgit v1.2.3-13-gbd6f