From da12f6a4584c4bdd386a420a81bbb51d0f94c12f Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Sun, 1 Aug 2021 11:12:57 -0400 Subject: Move the creation of the info file to after the PR directory check in `create_pull_request_dir()`. --- git.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/git.c b/git.c index 61c2408..495b08f 100644 --- a/git.c +++ b/git.c @@ -304,18 +304,18 @@ int create_pull_request_dir(pull_request *pr, int id, const char *root) { /* 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; - } - /* Is there no existing directory? */ if (stat(pr_dir, &st) < 0) { /* Create a directory with a name of the stringified ID. */ mkdir(pr_dir, 0755); } + /* 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 patch files. */ commits = (pr->pr_type) ? get_branch_commits(pr->branch) : pr->patches; -- cgit v1.2.3-13-gbd6f