Skip to content

Commit

Permalink
Fix support for mirroring tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
Zimmi48 committed Oct 6, 2023
1 parent 915b364 commit 16cc99c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/actions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2277,7 +2277,7 @@ let remove_labels_if_present ~bot_info (issue : issue_info) labels =
let mirror_action ~bot_info ?(force = true) ~gitlab_domain ~owner ~repo
~base_ref ~head_sha () =
(let open Lwt_result.Infix in
let local_ref = head_sha in
let local_ref = base_ref ^ "-" ^ head_sha in
let gh_ref =
{repo_url= f "https://github.com/%s/%s" owner repo; name= base_ref}
in
Expand All @@ -2293,7 +2293,7 @@ let mirror_action ~bot_info ?(force = true) ~gitlab_domain ~owner ~repo
| Ok () ->
Lwt.return_unit
| Error e ->
Lwt_io.printlf "Error while mirroring branch %s of repository %s/%s: %s"
Lwt_io.printlf "Error while mirroring branch/tag %s of repository %s/%s: %s"
base_ref owner repo e

(* TODO: ensure there's no race condition for 2 push with very close timestamps *)
Expand All @@ -2302,10 +2302,10 @@ let update_pr ?full_ci ?(skip_author_check = false) ~bot_info
let open Lwt_result.Infix in
(* Try as much as possible to get unique refnames for local branches. *)
let local_head_branch =
f "head-%s-%s" pr_info.head.branch.name pr_info.head.sha
f "refs/heads/head-%s-%s" pr_info.head.branch.name pr_info.head.sha
in
let local_base_branch =
f "base-%s-%s" pr_info.base.branch.name pr_info.base.sha
f "refs/heads/base-%s-%s" pr_info.base.branch.name pr_info.base.sha
in
git_fetch pr_info.base.branch local_base_branch
|&& git_fetch pr_info.head.branch local_head_branch
Expand Down
2 changes: 1 addition & 1 deletion src/git_utils.ml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ let execute_cmd command =
report_status command "was stopped by signal number" signal

let git_fetch ?(force = true) remote_ref local_branch_name =
f "git fetch --quiet -fu %s %s%s:refs/heads/%s" remote_ref.repo_url
f "git fetch --quiet -fu %s %s%s:%s" remote_ref.repo_url
(if force then "+" else "")
(Stdlib.Filename.quote remote_ref.name)
(Stdlib.Filename.quote local_branch_name)
Expand Down

0 comments on commit 16cc99c

Please sign in to comment.