From 897c677430a053df739d810554bb0320fedbc15b Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sat, 17 May 2014 09:10:10 +0200 Subject: fix position of static file import in import sequence --- context_mirror_bot.ml | 46 +++++++++++++++++++++++++++------------------- 1 file 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 = -- cgit v1.2.3