GitLab wird am Montag, den 31. Januar, zwischen 08:00 und 12:00 Uhr wegen wichtigen Wartungsarbeiten nicht zur Verfügung stehen.

Commit 3c764b18 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre Committed by GitLab Release Tools Bot
Browse files

Merge branch 'sh-create-branch-as-project-owner-for-github-import' into 'master'

GitHub import: Create new branches as project owner

See merge request gitlab-org/gitlab-ce!26335

(cherry picked from commit 6e74eb4e)

1e6ea914 GitHub import: Create new branches as project owner
parent a3473b4c
title: 'GitHub import: Create new branches as project owner'
merge_request: 26335
type: fixed
......@@ -89,7 +89,7 @@ def create_source_branch_if_not_exists(merge_request)
return if project.repository.branch_exists?(source_branch)
project.repository.add_branch(, source_branch, pull_request.source_branch_sha)
project.repository.add_branch(project.owner, source_branch, pull_request.source_branch_sha)
rescue Gitlab::Git::CommandError => e
extra: {
......@@ -273,6 +273,11 @@
mr.state = 'opened'
# Ensure the project owner is creating the branches because the
# merge request author may not have access to push to this
# repository.
allow(project.repository).to receive(:add_branch).with(project.owner, anything, anything).and_call_original
importer.insert_git_data(mr, exists)
expect(project.repository.branch_exists?(mr.source_branch)).to be_truthy
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