Commit 75e1682c authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'sh-fix-github-import-creator' into 'master'

GitHub importer: Use the project creator to create branches from forks

Closes #59396

See merge request gitlab-org/gitlab-ce!26510
parents 4e045cd5 d0336ae8
---
title: 'GitHub importer: Use the project creator to create branches from forks'
merge_request: 26510
author:
type: fixed
...@@ -89,7 +89,7 @@ module Gitlab ...@@ -89,7 +89,7 @@ module Gitlab
return if project.repository.branch_exists?(source_branch) return if project.repository.branch_exists?(source_branch)
project.repository.add_branch(project.owner, source_branch, pull_request.source_branch_sha) project.repository.add_branch(project.creator, source_branch, pull_request.source_branch_sha)
rescue Gitlab::Git::CommandError => e rescue Gitlab::Git::CommandError => e
Gitlab::Sentry.track_acceptable_exception(e, Gitlab::Sentry.track_acceptable_exception(e,
extra: { extra: {
......
...@@ -273,10 +273,10 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi ...@@ -273,10 +273,10 @@ describe Gitlab::GithubImport::Importer::PullRequestImporter, :clean_gitlab_redi
mr.state = 'opened' mr.state = 'opened'
mr.save mr.save
# Ensure the project owner is creating the branches because the # Ensure the project creator is creating the branches because the
# merge request author may not have access to push to this # merge request author may not have access to push to this
# repository. # repository. The project owner may also be a group.
allow(project.repository).to receive(:add_branch).with(project.owner, anything, anything).and_call_original allow(project.repository).to receive(:add_branch).with(project.creator, anything, anything).and_call_original
importer.insert_git_data(mr, exists) importer.insert_git_data(mr, exists)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment