Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
6553773dd0
commit
bd5d5791c5
13 changed files with 105 additions and 22 deletions
5
changelogs/unreleased/199843-fix-viewing-nil-blobs.yml
Normal file
5
changelogs/unreleased/199843-fix-viewing-nil-blobs.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Fix display of some overflowing merge request diffs
|
||||
merge_request: 29267
|
||||
author:
|
||||
type: fixed
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Expose the updated_at attribute in the todos API
|
||||
merge_request: 30035
|
||||
author:
|
||||
type: changed
|
|
@ -101,7 +101,8 @@ Example Response:
|
|||
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
|
||||
"body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
|
||||
"state": "pending",
|
||||
"created_at": "2016-06-17T07:52:35.225Z"
|
||||
"created_at": "2016-06-17T07:52:35.225Z",
|
||||
"updated_at": "2016-06-17T07:52:35.225Z"
|
||||
},
|
||||
{
|
||||
"id": 98,
|
||||
|
@ -174,7 +175,8 @@ Example Response:
|
|||
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
|
||||
"body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
|
||||
"state": "pending",
|
||||
"created_at": "2016-06-17T07:49:24.624Z"
|
||||
"created_at": "2016-06-17T07:49:24.624Z",
|
||||
"updated_at": "2016-06-17T07:49:24.624Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
@ -272,7 +274,8 @@ Example Response:
|
|||
"target_url": "https://gitlab.example.com/gitlab-org/gitlab-foss/-/merge_requests/7",
|
||||
"body": "Dolores in voluptatem tenetur praesentium omnis repellendus voluptatem quaerat.",
|
||||
"state": "done",
|
||||
"created_at": "2016-06-17T07:52:35.225Z"
|
||||
"created_at": "2016-06-17T07:52:35.225Z",
|
||||
"updated_at": "2016-06-17T07:52:35.225Z"
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ that apply to all GitLab content, not just documentation.
|
|||
|
||||
The documentation of GitLab products and features is the SSOT for all information related to implementation, usage, and troubleshooting. It evolves continually, in keeping with new products and features, and with improvements for clarity, accuracy, and completeness.
|
||||
|
||||
This policy prevents information silos, ensuring that it remains easy to find information about GitLab products.
|
||||
This policy prevents information silos, making it easier to find information about GitLab products.
|
||||
|
||||
It also informs decisions about the kinds of content we include in our documentation.
|
||||
|
||||
|
@ -61,7 +61,7 @@ Instead, link to the SSOT and explain why it is important to consume the informa
|
|||
|
||||
### Organize by topic, not by type
|
||||
|
||||
Beyond top-level audience-type folders (for example, `administration`), we organize content by topic, not by type, so that it can be located as easily as possible within the single-source-of-truth (SSOT) section for the subject matter.
|
||||
Beyond top-level audience-type folders (for example, `administration`), we organize content by topic, not by type, so it can be located as easily as possible within the single-source-of-truth (SSOT) section for the subject matter.
|
||||
|
||||
For example, do not create groupings of similar media types. For example:
|
||||
|
||||
|
@ -76,7 +76,7 @@ and cross-link between any related content.
|
|||
|
||||
### Docs-first methodology
|
||||
|
||||
We employ a **docs-first methodology** to help ensure that the docs remain a complete and trusted resource, and to make communicating about the use of GitLab more efficient.
|
||||
We employ a **docs-first methodology** to help ensure the docs remain a complete and trusted resource, and to make communicating about the use of GitLab more efficient.
|
||||
|
||||
- If the answer to a question exists in documentation, share the link to the docs instead of rephrasing the information.
|
||||
- When you encounter new information not available in GitLab’s documentation (for example, when working on a support case or testing a feature), your first step should be to create a merge request (MR) to add this information to the docs. You can then share the MR in order to communicate this information.
|
||||
|
@ -129,13 +129,13 @@ correctly, but is not the current standard for GitLab documentation).
|
|||
A rule that could cause confusion is `MD044/proper-names`, as it might not be immediately
|
||||
clear what caused markdownlint to fail, or how to correct the failure. This rule
|
||||
checks a list of known words, listed in the `.markdownlint.json` file in each project,
|
||||
to verify that proper capitalization and backticks are used. Words in backticks will
|
||||
to verify proper use of capitalization and backticks. Words in backticks will
|
||||
be ignored by markdownlint.
|
||||
|
||||
In general, product names should follow the exact capitalization of the official names
|
||||
of the products, protocols, and so on.
|
||||
|
||||
Some examples that will fail if incorrect capitalization is used:
|
||||
Some examples fail if incorrect capitalization is used:
|
||||
|
||||
- MinIO (needs capital `IO`)
|
||||
- NGINX (needs all capitals)
|
||||
|
@ -252,6 +252,8 @@ GitLab documentation should be clear and easy to understand.
|
|||
- Avoid uncommon words.
|
||||
- Don't write in the first person singular.
|
||||
- Instead of "I" or "me," use "we," "you," "us," or "one."
|
||||
- When possible, stay user focused by writing in the second person ("you" or the imperative).
|
||||
- Don't overuse "that". In many cases, you can remove "that" from a sentence and improve readability.
|
||||
|
||||
### Point of view
|
||||
|
||||
|
|
|
@ -46,9 +46,12 @@ Pa11y against the webpages defined in `a11y_urls`, and builds an HTML report for
|
|||
|
||||
The report for each URL is saved as an artifact that can be [viewed directly in your browser](../../../ci/pipelines/job_artifacts.md#browsing-artifacts).
|
||||
|
||||
A single `accessibility.json` artifact is created and saved along with the individual HTML reports.
|
||||
A single `gl-accessibility.json` artifact is created and saved along with the individual HTML reports.
|
||||
It includes report data for all URLs scanned.
|
||||
|
||||
NOTE: **Note:**
|
||||
For GitLab 12.10 and earlier, the [artifact generated is named `accessibility.json`](https://gitlab.com/gitlab-org/ci-cd/accessibility/-/merge_requests/9).
|
||||
|
||||
NOTE: **Note:**
|
||||
For GitLab versions earlier than 12.9, you can use `include:remote` and use a
|
||||
link to the [current template in `master`](https://gitlab.com/gitlab-org/gitlab/-/raw/master/lib/gitlab/ci/templates/Verify/Accessibility.gitlab-ci.yml)
|
||||
|
|
|
@ -22,6 +22,7 @@ module API
|
|||
expose :body
|
||||
expose :state
|
||||
expose :created_at
|
||||
expose :updated_at
|
||||
|
||||
def todo_target_class(target_type)
|
||||
# false as second argument prevents looking up in module hierarchy
|
||||
|
|
|
@ -72,18 +72,17 @@ module DeclarativePolicy
|
|||
end
|
||||
|
||||
def compute_class_for_class(subject_class)
|
||||
subject_class.ancestors.each do |klass|
|
||||
next unless klass.name
|
||||
|
||||
begin
|
||||
klass_name =
|
||||
if subject_class.respond_to?(:declarative_policy_class)
|
||||
subject_class.declarative_policy_class
|
||||
else
|
||||
"#{klass.name}Policy"
|
||||
return subject_class.declarative_policy_class.constantize
|
||||
end
|
||||
|
||||
policy_class = klass_name.constantize
|
||||
subject_class.ancestors.each do |klass|
|
||||
name = klass.name
|
||||
|
||||
next unless name
|
||||
|
||||
begin
|
||||
policy_class = "#{name}Policy".constantize
|
||||
|
||||
# NOTE: the < operator here tests whether policy_class
|
||||
# inherits from Base. We can't use #is_a? because that
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
# This has been extracted from https://github.com/github/linguist/blob/master/lib/linguist/blob_helper.rb
|
||||
module Gitlab
|
||||
module BlobHelper
|
||||
include Gitlab::Utils::StrongMemoize
|
||||
|
||||
def extname
|
||||
File.extname(name.to_s)
|
||||
end
|
||||
|
@ -120,8 +122,18 @@ module Gitlab
|
|||
end
|
||||
|
||||
def encoded_newlines_re
|
||||
@encoded_newlines_re ||=
|
||||
Regexp.union(["\r\n", "\r", "\n"].map { |nl| nl.encode(ruby_encoding, "ASCII-8BIT").force_encoding(data.encoding) })
|
||||
strong_memoize(:encoded_newlines_re) do
|
||||
newlines = ["\r\n", "\r", "\n"]
|
||||
data_encoding = data&.encoding
|
||||
|
||||
if ruby_encoding && data_encoding
|
||||
newlines.map! do |nl|
|
||||
nl.encode(ruby_encoding, "ASCII-8BIT").force_encoding(data_encoding)
|
||||
end
|
||||
end
|
||||
|
||||
Regexp.union(newlines)
|
||||
end
|
||||
end
|
||||
|
||||
def ruby_encoding
|
||||
|
|
|
@ -93,7 +93,7 @@ GEM
|
|||
rspec-support (3.7.0)
|
||||
rspec_junit_formatter (0.4.1)
|
||||
rspec-core (>= 2, < 4, != 2.12.0)
|
||||
ruby-debug-ide (0.7.0)
|
||||
ruby-debug-ide (0.7.2)
|
||||
rake (>= 0.8.1)
|
||||
rubyzip (1.3.0)
|
||||
selenium-webdriver (3.142.6)
|
||||
|
|
36
spec/lib/declarative_policy_spec.rb
Normal file
36
spec/lib/declarative_policy_spec.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe DeclarativePolicy do
|
||||
describe '.class_for' do
|
||||
it 'uses declarative_policy_class if present' do
|
||||
instance = Gitlab::ErrorTracking::ErrorEvent.new
|
||||
|
||||
expect(described_class.class_for(instance)).to eq(ErrorTracking::BasePolicy)
|
||||
end
|
||||
|
||||
it 'infers policy class from name' do
|
||||
instance = PersonalSnippet.new
|
||||
|
||||
expect(described_class.class_for(instance)).to eq(PersonalSnippetPolicy)
|
||||
end
|
||||
|
||||
it 'raises error if not found' do
|
||||
instance = Object.new
|
||||
|
||||
expect { described_class.class_for(instance) }.to raise_error('no policy for Object')
|
||||
end
|
||||
|
||||
context 'when found policy class does not inherit base' do
|
||||
class Foo; end
|
||||
class FooPolicy; end
|
||||
|
||||
it 'raises error if inferred class does not inherit Base' do
|
||||
instance = Foo.new
|
||||
|
||||
expect { described_class.class_for(instance) }.to raise_error('no policy for Foo')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -652,4 +652,16 @@ describe Gitlab::Git::Blob, :seed_helper do
|
|||
expect(described_class).to respond_to(:gitlab_blob_size)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#lines' do
|
||||
context 'when the encoding cannot be detected' do
|
||||
it 'successfully splits the data' do
|
||||
data = "test\nblob"
|
||||
blob = Gitlab::Git::Blob.new(name: 'test', size: data.bytesize, data: data)
|
||||
expect(blob).to receive(:ruby_encoding) { nil }
|
||||
|
||||
expect(blob.lines).to eq(data.split("\n"))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -235,6 +235,7 @@ describe API::Todos do
|
|||
expect(json_response['state']).to eq('pending')
|
||||
expect(json_response['action_name']).to eq('marked')
|
||||
expect(json_response['created_at']).to be_present
|
||||
expect(json_response['updated_at']).to be_present
|
||||
end
|
||||
|
||||
it 'returns 304 there already exist a todo on that issuable' do
|
||||
|
|
|
@ -22,7 +22,11 @@ module FakeBlobHelpers
|
|||
alias_method :name, :path
|
||||
|
||||
def id
|
||||
0
|
||||
"00000000"
|
||||
end
|
||||
|
||||
def commit_id
|
||||
"11111111"
|
||||
end
|
||||
|
||||
def binary_in_repo?
|
||||
|
|
Loading…
Reference in a new issue