From c62604d54a765273f34396e81ef3130dd21562a9 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sat, 30 Jul 2022 11:29:50 -0300 Subject: dev: Add some more test code --- pullreqd.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pullreqd.c b/pullreqd.c index 33da015..53973cd 100644 --- a/pullreqd.c +++ b/pullreqd.c @@ -160,6 +160,12 @@ int *init_socket(config *cfg) { int main_loop(config *cfg, int *listen_sockets, git_repo **repos) { int done = 0; struct stat st; + + index_t *idx = &(index_t) { + .type = 1, + .num = 0, + .next = NULL, + }; file **patches = (file *[]) { &(file){"lol.patch", "asfklhasflhk"}, &(file){"oof.patch", "you just got rekt by some young guy"}, @@ -174,10 +180,17 @@ int main_loop(config *cfg, int *listen_sockets, git_repo **repos) { } for (; !done;) { - if (create_pull_request_dir(pr, -1, cfg->pr_root) < 0) { + pull_request *new_pr; + if (create_pull_request_dir(pr, idx, cfg->pr_root) < 0) { log(LOG_ERR, "Failed to create Pull Request directory."); return -1; } + new_pr = get_pull_request(idx, cfg->pr_root); + if (new_pr == NULL) { + char *idx_str = index_to_str(idx); + log(LOG_ERR, "Failed to get Pull Request #%s.", idx_str); + free(idx_str); + } break; } -- cgit v1.2.3-13-gbd6f