From e6c47d770e699383096b076d856a59d172b112ba Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Fri, 5 Aug 2022 14:01:57 -0300 Subject: dev: Add some more test code for testing `create_pull_request_branch()` --- pullreqd.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pullreqd.c b/pullreqd.c index 30be263..d4e67ea 100644 --- a/pullreqd.c +++ b/pullreqd.c @@ -166,12 +166,18 @@ int main_loop(config *cfg, int *listen_sockets, git_repo **repos) { .num = 0, .next = NULL, }; + index_t *idx2 = &(index_t) { + .type = 1, + .num = 10, + .next = NULL, + }; file **patches = (file *[]) { &(file){"lol.patch", "asfklhasflhk"}, &(file){"oof.patch", "you just got rekt by some young guy"}, NULL }; pull_request *pr = &(pull_request){"lol", "oof", "some young guy", NULL, time(NULL), 0, {.patches = patches}, NULL}; + pull_request *pr2 = &(pull_request){"Give actkbd, the ability to turn into an epic Unix utility", "actkbd seems like a cool concept for a keyboard shortcut daemon, but I realised that it was very easy to print keypresses to stdout.\nSo that was what I did, but that was not enough, I really wanted the ability to get the keystate, every tick, which I did.\nOh yeah, I also fixed the regex used for autodetecting a keyboard, so that it actually works.\nHope you guys enjoy it!", "mrb0nk500", NULL, 1568423431, 1, {.branch = &(git_branch){.name = "master", .repo = "https://github.com/mrb0nk500/actkbd.git"}}, "master"}; /* Does the PR root directory exist? */ if (stat(cfg->pr_root, &st) < 0) { @@ -194,6 +200,16 @@ int main_loop(config *cfg, int *listen_sockets, git_repo **repos) { cleanup_pull_request(new_pr); new_pr = NULL; } + + if (create_pull_request_dir(pr2, idx2, cfg->pr_root, "actkbd") < 0) { + log(LOG_ERR, "Failed to create second Pull Request directory."); + return -1; + } + + if (create_pull_request_branch(pr2, idx2, get_repo(repos, "actkbd")) < 0) { + log(LOG_ERR, "Failed to create Pull Request branch."); + return -1; + } break; } -- cgit v1.2.3-13-gbd6f