diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-02 15:09:08 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-02 15:09:08 +0000 |
commit | 840d5ecdbbf8da3e03a7f0b8b465a89d1519807c (patch) | |
tree | 4e197815c026a947057f7b5cbcb5e3cf106cc22f /lib | |
parent | b0107e8756bf3287f8a6221252c800209a9c46f6 (diff) | |
download | gitlab-ce-840d5ecdbbf8da3e03a7f0b8b465a89d1519807c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/danger/helper.rb | 19 | ||||
-rw-r--r-- | lib/gitlab/diff/file_collection/wiki_page.rb | 24 | ||||
-rw-r--r-- | lib/gitlab/error_tracking/detailed_error.rb | 1 | ||||
-rw-r--r-- | lib/gitlab/git/wiki.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/operation_service.rb | 4 | ||||
-rw-r--r-- | lib/sentry/client/issue.rb | 3 |
6 files changed, 46 insertions, 9 deletions
diff --git a/lib/gitlab/danger/helper.rb b/lib/gitlab/danger/helper.rb index 327418ad100..58f9d1196cf 100644 --- a/lib/gitlab/danger/helper.rb +++ b/lib/gitlab/danger/helper.rb @@ -73,16 +73,16 @@ module Gitlab # @return [Hash<String,Array<String>>] def changes_by_category all_changed_files.each_with_object(Hash.new { |h, k| h[k] = [] }) do |file, hash| - hash[category_for_file(file)] << file + categories_for_file(file).each { |category| hash[category] << file } end end - # Determines the category a file is in, e.g., `:frontend` or `:backend` - # @return[Symbol] - def category_for_file(file) - _, category = CATEGORIES.find { |regexp, _| regexp.match?(file) } + # Determines the categories a file is in, e.g., `[:frontend]`, `[:backend]`, or `%i[frontend engineering_productivity]`. + # @return Array<Symbol> + def categories_for_file(file) + _, categories = CATEGORIES.find { |regexp, _| regexp.match?(file) } - category || :unknown + Array(categories || :unknown) end # Returns the GFM for a category label, making its best guess if it's not @@ -125,10 +125,13 @@ module Gitlab jest\.config\.js | package\.json | yarn\.lock | - config/.+\.js | - \.gitlab/ci/frontend\.gitlab-ci\.yml + config/.+\.js )\z}x => :frontend, + %r{(\A|/)( + \.gitlab/ci/frontend\.gitlab-ci\.yml + )\z}x => %i[frontend engineering_productivity], + %r{\A(ee/)?db/(?!fixtures)[^/]+} => :database, %r{\A(ee/)?lib/gitlab/(database|background_migration|sql|github_import)(/|\.rb)} => :database, %r{\A(app/models/project_authorization|app/services/users/refresh_authorized_projects_service)(/|\.rb)} => :database, diff --git a/lib/gitlab/diff/file_collection/wiki_page.rb b/lib/gitlab/diff/file_collection/wiki_page.rb new file mode 100644 index 00000000000..7873e85a0eb --- /dev/null +++ b/lib/gitlab/diff/file_collection/wiki_page.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Gitlab + module Diff + module FileCollection + class WikiPage < Base + def initialize(page, diff_options:) + commit = page.wiki.commit(page.version.commit) + diff_options = diff_options.merge( + expanded: true, + paths: [page.path] + ) + + super(commit, + # TODO: Uncouple diffing from projects + # https://gitlab.com/gitlab-org/gitlab/-/issues/217752 + project: page.wiki, + diff_options: diff_options, + diff_refs: commit.diff_refs) + end + end + end + end +end diff --git a/lib/gitlab/error_tracking/detailed_error.rb b/lib/gitlab/error_tracking/detailed_error.rb index b49f2472e01..5d272efa64a 100644 --- a/lib/gitlab/error_tracking/detailed_error.rb +++ b/lib/gitlab/error_tracking/detailed_error.rb @@ -22,6 +22,7 @@ module Gitlab :id, :last_release_last_commit, :last_release_short_version, + :last_release_version, :last_seen, :message, :project_id, diff --git a/lib/gitlab/git/wiki.rb b/lib/gitlab/git/wiki.rb index 3025fc6bfdb..76771f0417b 100644 --- a/lib/gitlab/git/wiki.rb +++ b/lib/gitlab/git/wiki.rb @@ -101,6 +101,10 @@ module Gitlab wrapped_gitaly_errors do gitaly_find_page(title: title, version: version, dir: dir) end + rescue Gitlab::Git::CommandError + # Return nil for invalid versions. + # This can be removed with https://gitlab.com/gitlab-org/gitaly/-/merge_requests/2323 in place. + nil end def file(name, version) diff --git a/lib/gitlab/gitaly_client/operation_service.rb b/lib/gitlab/gitaly_client/operation_service.rb index 9ed4b2da09a..87505418ae9 100644 --- a/lib/gitlab/gitaly_client/operation_service.rb +++ b/lib/gitlab/gitaly_client/operation_service.rb @@ -178,6 +178,10 @@ module Gitlab timeout: GitalyClient.long_timeout ) + if response.pre_receive_error.present? + raise Gitlab::Git::PreReceiveError.new("GL-HOOK-ERR: pre-receive hook failed.") + end + Gitlab::Git::OperationService::BranchUpdate.from_gitaly(response.branch_update) rescue GRPC::FailedPrecondition => e raise Gitlab::Git::CommitError, e diff --git a/lib/sentry/client/issue.rb b/lib/sentry/client/issue.rb index 4a62b73a349..c5e9df9cd21 100644 --- a/lib/sentry/client/issue.rb +++ b/lib/sentry/client/issue.rb @@ -168,7 +168,8 @@ module Sentry first_release_short_version: issue.dig('firstRelease', 'shortVersion'), first_release_version: issue.dig('firstRelease', 'version'), last_release_last_commit: issue.dig('lastRelease', 'lastCommit'), - last_release_short_version: issue.dig('lastRelease', 'shortVersion') + last_release_short_version: issue.dig('lastRelease', 'shortVersion'), + last_release_version: issue.dig('lastRelease', 'version') }) end |