summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-08-06 12:13:28 -0300
committermrb0nk500 <b0nk@b0nk.xyz>2022-08-06 12:13:28 -0300
commitfbe98f57dc779069bd283ac1773866ce73727ea0 (patch)
treef5091e55374f4bf91ae011cf856519bc829327de /git.c
parenta185caea7fbc0969829b96af3f43e8ae980df000 (diff)
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`.
Diffstat (limited to 'git.c')
-rw-r--r--git.c10
1 files changed, 10 insertions, 0 deletions
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;