From 696bc8db36957e43756d88a093969ef16e8a4a47 Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Wed, 30 Jun 2021 09:31:10 -0400 Subject: Moved assignment of `pr_dir` to before the creation of the info file. --- git.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git.c b/git.c index a767624..191b800 100644 --- a/git.c +++ b/git.c @@ -256,15 +256,16 @@ int create_pull_request_dir(pull_request *pr, int id, const char *root) { log(LOG_ERR, "Negative ID, and either blank, or NULL Pull Request title."); return -1; } + + /* Get the path of the PR's directory. */ + pr_dir = (pr->title != NULL && pr->title[0] != '\0') ? dir_path_name(root, sanitize_str(pr->title)) : dir_path_num(root, id); + /* Did we fail to create the info file? */ if (!create_info_file(pr, pr_dir)) { log(LOG_ERR, "Failed to create info file."); return -1; } - /* Get the path of the PR's directory. */ - pr_dir = (pr->title != NULL && pr->title[0] != '\0') ? dir_path_name(root, sanitize_str(pr->title)) : dir_path_num(root, id); - /* Is there no existing directory? */ if (stat(pr_dir, &st) < -1) { /* Create a directory with a name of the stringified ID. */ -- cgit v1.2.3-13-gbd6f