diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2022-08-01 11:11:49 -0300 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2022-08-01 11:11:49 -0300 |
commit | 705cd82152b3228cb5162c8e5680b77074bdac91 (patch) | |
tree | e6cc38b36a9c5774b959d6a5b686ac61de87e46a /git.c | |
parent | fb6bcf3f91b0297f218a91cedabfbed875c1b432 (diff) |
git: Add `parse_remote_branch()` callback
This needs to be done in order to properly allocate the remote branch
before setting it's members.
Diffstat (limited to 'git.c')
-rw-r--r-- | git.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -166,6 +166,21 @@ static linked_list *parse_dsv_str(const char *str, const char *delm) { return tail; } +int parse_remote_branch(void *ctx, void *ret, const keyword *key, keyword_val val) { + if (key->type != TYPE_STRING) { + if (key->offsets[0] == offsetof(pull_request, branch)) { + if (key->offsets[1] == offsetof(git_branch, name) || key->offsets[1] == offsetof(git_branch, repo)) { + pull_request *pr = (pull_request *)ret; + if (pr->branch == NULL) { + pr->branch = calloc(1, sizeof(git_branch)); + } + return 0; + } + } + } + return -1; +} + int parse_patch_list(void *ctx, void *ret, const keyword *key, keyword_val val) { /* Do we actually have a "patches" keyword? */ if (key->type == TYPE_STRING) { |