From fbe98f57dc779069bd283ac1773866ce73727ea0 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sat, 6 Aug 2022 12:13:28 -0300 Subject: git: Add `get_pr_type()` keyword getter callback This callback is needed because `pr_type` is a `uint8_t`, but the keyword type is `TYPE_INT` which assumes that the type is an `int`. --- git.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'git.c') diff --git a/git.c b/git.c index e20cfd6..e56035b 100644 --- a/git.c +++ b/git.c @@ -377,6 +377,16 @@ pull_request *get_pull_request(index_t *idx, const char *root, const char *repo) } } +int get_pr_type(void *ctx, void *data, const keyword *key, keyword_val *val) { + pull_request *pr = (pull_request *)data; + if (key->type == TYPE_INT && pr != NULL) { + val->i = pr->pr_type; + return 1; + } else { + return -1; + } +} + int has_remote_branch(void *ctx, void *data, const keyword *key, keyword_val *val) { pull_request *pr = (pull_request *)data; return (pr->pr_type) ? 0 : -1; -- cgit v1.2.3-13-gbd6f