summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-08-01 11:12:57 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2021-08-01 11:12:57 -0400
commitda12f6a4584c4bdd386a420a81bbb51d0f94c12f (patch)
tree020815344868b93666b40213c9daccd09baf1f85 /git.c
parent455889c21496d691bd0c250b7c9401b53b5c5062 (diff)
Move the creation of the info file to after the
PR directory check in `create_pull_request_dir()`.
Diffstat (limited to 'git.c')
-rw-r--r--git.c12
1 files 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;