diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2014-05-17 09:10:10 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2014-05-17 09:10:10 +0200 |
commit | 897c677430a053df739d810554bb0320fedbc15b (patch) | |
tree | 651159751427495e8789972e1a5aa3ca05cd3e89 | |
parent | 9920c7babc22260bfb154281db531a0250744d8d (diff) | |
download | context-mirror-bot-897c677430a053df739d810554bb0320fedbc15b.tar.gz |
fix position of static file import in import sequence
-rw-r--r-- | context_mirror_bot.ml | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/context_mirror_bot.ml b/context_mirror_bot.ml index a080dea..d937c98 100644 --- a/context_mirror_bot.ml +++ b/context_mirror_bot.ml @@ -385,27 +385,35 @@ end = struct dst (if needs_branch then "new" else "old") branch); - match exec_commands [ (Printf.sprintf "rm -rf -- %s/*" repo_dir); - (Printf.sprintf "mv %s/* %s/" dst repo_dir); - (Printf.sprintf "git add --all %s/" repo_dir); - "git add --update"; - ] with + match exec_commands [ + (* remove current contents and replace it with the extracted files *) + (Printf.sprintf "rm -rf -- %s/*" repo_dir); + (Printf.sprintf "mv %s/* %s/" dst repo_dir); + ] with | Bad errmsg -> Import_failed errmsg | Good -> - begin - if needs_branch then - begin - match list_of_pipe (Printf.sprintf "git checkout -b %s" branch) with - | Some _ -> () - | None -> raise (Git_branch_failed branch) - end; - if import_static_files () = false then - raise Import_files_failed - else - match list_of_pipe (Printf.sprintf "git commit --message=\"%s\"" (format_time ts)) with - | Some _ -> gc (); Imported branch - | None -> raise (Git_commit_failed branch) - end + if import_static_files () = false then + raise Import_files_failed + else (* -> git add; git commit *) + begin + match exec_commands [ + (Printf.sprintf "git add --all %s/" repo_dir); + "git add --update"; + ] with + | Bad errmsg -> Import_failed errmsg + | Good -> + begin + if needs_branch then + begin + match list_of_pipe (Printf.sprintf "git checkout -b %s" branch) with + | Some _ -> () + | None -> raise (Git_branch_failed branch) + end; + match list_of_pipe (Printf.sprintf "git commit --message=\"%s\"" (format_time ts)) with + | Some _ -> gc (); Imported branch + | None -> raise (Git_commit_failed branch) + end + end end let push br = |