diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-02-24 18:32:10 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-02-24 18:55:01 +0300 |
commit | a530e9da3580e05a171b3ba0a3f4408afc000b10 (patch) | |
tree | 49e3787d12d2e7d3a40e3cdf1af0ff8643ac99e1 /app | |
parent | 9e39b317a3865688e9fb204fb8680d3e91958fec (diff) |
Address review
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository.rb | 4 | ||||
-rw-r--r-- | app/services/files/multi_service.rb | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 73256df0591..c3fceddb9ca 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -753,7 +753,7 @@ class Repository author_email: nil, author_name: nil, start_branch_name: nil, start_project: project) - entry = tree_entry_at(start_branch_name || branch_name, path) + entry = start_project.repository.tree_entry_at(start_branch_name || branch_name, path) if entry if entry[:type] == :blob raise Gitlab::Git::Repository::InvalidBlobName.new( @@ -865,7 +865,7 @@ class Repository end actions.each do |options| - index.__send__(options.delete(:action), options) + index.public_send(options.delete(:action), options) end options = { diff --git a/app/services/files/multi_service.rb b/app/services/files/multi_service.rb index 809fa32eca5..2c89f6e7f92 100644 --- a/app/services/files/multi_service.rb +++ b/app/services/files/multi_service.rb @@ -22,6 +22,12 @@ module Files def validate super params[:actions].each_with_index do |action, index| + if ACTIONS.include?(action[:action].to_s) + action[:action] = action[:action].to_sym + else + raise_error("Unknown action type `#{action[:action]}`.") + end + unless action[:file_path].present? raise_error("You must specify a file_path.") end @@ -32,12 +38,6 @@ module Files regex_check(action[:file_path]) regex_check(action[:previous_path]) if action[:previous_path] - if ACTIONS.include?(action[:action].to_s) - action[:action] = action[:action].to_sym - else - raise_error("Unknown action type `#{action[:action]}`.") - end - if project.empty_repo? && action[:action] != :create raise_error("No files to #{action[:action]}.") end |