Import PR refs as branches using the GitHub import
There could be a reason to do it this way I'm ignoring, so feel free to close this issue if so.
At the moment we use the following configuration:
def set_remote_as_mirror(name)
config = raw_repository.rugged.config
# This is used to define repository as equivalent as "git clone --mirror"
config["remote.#{name}.fetch"] = 'refs/*:refs/*'
config["remote.#{name}.mirror"] = true
config["remote.#{name}.prune"] = true
end
- We fetch all refs, including
refs/pull/*/{merge,head} - For every imported MR, we fetch the ref again and create the branch that actually points to
ref/pull/###/head
Suggestion: Change remote.#{name}.fetch to match refs/pull/* and create them as branches under /heads, that way we can modify the source_branch to point to this and we don't need to fetch these refs again.
Edited by James Lopez