diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-10-05 04:13:06 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-10-05 04:13:06 +0300 |
commit | af2c51d7ca73e16cdb9a11fff6d097116c7c5324 (patch) | |
tree | cd7f07f36e09a357902a262cbb932f25d254a16c /lib | |
parent | acfe7ec65c75f65f2f87bf3e8598c1725c9150f4 (diff) | |
parent | f71c497f5da791a35876206255e342a9bb5e49c5 (diff) |
Merge branch 'master-ce' into scheduled-manual-jobs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/commits.rb | 3 | ||||
-rw-r--r-- | lib/api/runners.rb | 2 | ||||
-rw-r--r-- | lib/banzai/filter/epic_reference_filter.rb | 6 | ||||
-rw-r--r-- | lib/declarative_policy.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/diff/position.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/git_access.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/url_sanitizer.rb | 2 |
7 files changed, 16 insertions, 7 deletions
diff --git a/lib/api/commits.rb b/lib/api/commits.rb index ff927d1aa3c..e59abd3e3d0 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -98,6 +98,7 @@ module API optional :start_branch, type: String, desc: 'Name of the branch to start the new commit from' optional :author_email, type: String, desc: 'Author email for commit' optional :author_name, type: String, desc: 'Author name for commit' + optional :stats, type: Boolean, default: true, desc: 'Include commit stats' end post ':id/repository/commits' do authorize_push_to_branch!(params[:branch]) @@ -113,7 +114,7 @@ module API Gitlab::WebIdeCommitsCounter.increment if find_user_from_warden - present commit_detail, with: Entities::CommitDetail + present commit_detail, with: Entities::CommitDetail, stats: params[:stats] else render_api_error!(result[:message], 400) end diff --git a/lib/api/runners.rb b/lib/api/runners.rb index 60868821810..ce70460af11 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -113,7 +113,7 @@ module API optional :status, type: String, desc: 'Status of the job', values: Ci::Build::AVAILABLE_STATUSES use :pagination end - get ':id/jobs' do + get ':id/jobs' do runner = get_runner(params[:id]) authenticate_list_runners_jobs!(runner) diff --git a/lib/banzai/filter/epic_reference_filter.rb b/lib/banzai/filter/epic_reference_filter.rb index e06e2fb3870..26bcf5c04b4 100644 --- a/lib/banzai/filter/epic_reference_filter.rb +++ b/lib/banzai/filter/epic_reference_filter.rb @@ -9,6 +9,12 @@ module Banzai def self.object_class Epic end + + private + + def group + context[:group] || context[:project]&.group + end end end end diff --git a/lib/declarative_policy.rb b/lib/declarative_policy.rb index dda6cd38dcd..10d34b0c6e7 100644 --- a/lib/declarative_policy.rb +++ b/lib/declarative_policy.rb @@ -10,8 +10,6 @@ require_dependency 'declarative_policy/step' require_dependency 'declarative_policy/base' -require 'thread' - module DeclarativePolicy CLASS_CACHE_MUTEX = Mutex.new CLASS_CACHE_IVAR = :@__DeclarativePolicy_CLASS_CACHE diff --git a/lib/gitlab/diff/position.rb b/lib/gitlab/diff/position.rb index fc280f96ec1..f967494199e 100644 --- a/lib/gitlab/diff/position.rb +++ b/lib/gitlab/diff/position.rb @@ -69,6 +69,10 @@ module Gitlab JSON.generate(formatter.to_h, opts) end + def as_json(opts = nil) + to_h.as_json(opts) + end + def type formatter.line_age end diff --git a/lib/gitlab/git_access.rb b/lib/gitlab/git_access.rb index 30cd09a0ca7..240a0d7d1b8 100644 --- a/lib/gitlab/git_access.rb +++ b/lib/gitlab/git_access.rb @@ -24,8 +24,8 @@ module Gitlab cannot_push_to_read_only: "You can't push code to a read-only GitLab instance." }.freeze - DOWNLOAD_COMMANDS = %w{ git-upload-pack git-upload-archive }.freeze - PUSH_COMMANDS = %w{ git-receive-pack }.freeze + DOWNLOAD_COMMANDS = %w{git-upload-pack git-upload-archive}.freeze + PUSH_COMMANDS = %w{git-receive-pack}.freeze ALL_COMMANDS = DOWNLOAD_COMMANDS + PUSH_COMMANDS attr_reader :actor, :project, :protocol, :authentication_abilities, :namespace_path, :project_path, :redirected_path, :auth_result_type, :changes diff --git a/lib/gitlab/url_sanitizer.rb b/lib/gitlab/url_sanitizer.rb index 308a95d2f09..29672d68cad 100644 --- a/lib/gitlab/url_sanitizer.rb +++ b/lib/gitlab/url_sanitizer.rb @@ -3,7 +3,7 @@ module Gitlab ALLOWED_SCHEMES = %w[http https ssh git].freeze def self.sanitize(content) - regexp = URI::Parser.new.make_regexp(ALLOWED_SCHEMES) + regexp = URI::DEFAULT_PARSER.make_regexp(ALLOWED_SCHEMES) content.gsub(regexp) { |url| new(url).masked_url } rescue Addressable::URI::InvalidURIError |