summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--context_mirror_bot.ml46
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 =