diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-12-08 10:23:41 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-12-08 10:23:41 +0300 |
commit | cf677378ee8104e7505cf0670ad45a51613af575 (patch) | |
tree | e71c013d4d8e5df07f64352762e61859d2cda59c /app/services/files | |
parent | 4f94053c21196b3445c117130e3556463e4ca1d0 (diff) |
Prefer repository.branch_exists?
Diffstat (limited to 'app/services/files')
-rw-r--r-- | app/services/files/base_service.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb index 6779bd2818a..80e1d1d60f2 100644 --- a/app/services/files/base_service.rb +++ b/app/services/files/base_service.rb @@ -5,7 +5,7 @@ module Files def execute @source_project = params[:source_project] || @project @source_branch = params[:source_branch] - @target_branch = params[:target_branch] + @target_branch = params[:target_branch] @commit_message = params[:commit_message] @file_path = params[:file_path] @@ -59,12 +59,12 @@ module Files end unless project.empty_repo? - unless @source_project.repository.branch_names.include?(@source_branch) + unless @source_project.repository.branch_exists?(@source_branch) raise_error('You can only create or edit files when you are on a branch') end if different_branch? - if repository.branch_names.include?(@target_branch) + if repository.branch_exists?(@target_branch) raise_error('Branch with such name already exists. You need to switch to this branch in order to make changes') end end |