Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-11-15 02:22:50 +0300
committerLin Jen-Shin <godfat@godfat.org>2016-11-15 02:51:09 +0300
commitd8fe2fac7e681ddbff3c7a5338f939eb2d540e38 (patch)
tree505a78a33a4c7840c14dff78f40ca3617da91065 /app/services/files
parent5de74551ace7b6df9fdb2a3c8aa30c836d693728 (diff)
Make sure we have the branch on the other project
Diffstat (limited to 'app/services/files')
-rw-r--r--app/services/files/base_service.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb
index 6779bd2818a..fd62246eddb 100644
--- a/app/services/files/base_service.rb
+++ b/app/services/files/base_service.rb
@@ -23,7 +23,7 @@ module Files
validate
# Create new branch if it different from source_branch
- validate_target_branch if different_branch?
+ ensure_target_branch if different_branch?
result = commit
if result
@@ -71,6 +71,14 @@ module Files
end
end
+ def ensure_target_branch
+ validate_target_branch
+
+ if @source_project != project
+ @project.fetch_ref(@source_project, @target_branch, @source_branch)
+ end
+ end
+
def validate_target_branch
result = ValidateNewBranchService.new(project, current_user).
execute(@target_branch)