Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-06-27 00:08:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-06-27 00:08:51 +0300
commit757d2fda7e2936b071a4cb600046ca375051d7c5 (patch)
tree76673008cb2e31c1df8705d0388fd3cabdd79d2d
parentebe92e84a92d7d00710a6c5017ef2bb160268471 (diff)
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock4
-rw-r--r--app/assets/javascripts/behaviors/shortcuts/shortcuts_toggle.vue28
-rw-r--r--app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue8
-rw-r--r--app/controllers/projects/blob_controller.rb2
-rw-r--r--app/graphql/resolvers/last_commit_resolver.rb2
-rw-r--r--app/models/repository.rb7
-rw-r--r--app/services/files/base_service.rb2
-rw-r--r--app/views/help/_shortcuts.html.haml4
-rw-r--r--changelogs/unreleased/502-add-toggles-help-text-int-test-gitlab-ui-integration-test.yml5
-rw-r--r--changelogs/unreleased/sh-fix-gitaly-bug-2857-for-dirs.yml5
-rw-r--r--lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb17
-rw-r--r--lib/gitlab/git/commit.rb5
-rw-r--r--lib/gitlab/git/repository.rb4
-rw-r--r--lib/gitlab/gitaly_client/commit_service.rb18
-rw-r--r--lib/gitlab/tree_summary.rb2
-rw-r--r--locale/gitlab.pot24
-rw-r--r--package.json4
-rw-r--r--qa/qa/page/component/issuable/sidebar.rb4
-rw-r--r--spec/features/projects/commits/user_browses_commits_spec.rb27
-rw-r--r--spec/features/projects/files/user_browses_files_spec.rb2
-rw-r--r--spec/features/projects/tree/tree_show_spec.rb10
-rw-r--r--spec/frontend/registry/shared/components/__snapshots__/expiration_policy_fields_spec.js.snap4
-rw-r--r--spec/frontend/self_monitor/components/__snapshots__/self_monitor_form_spec.js.snap4
-rw-r--r--spec/graphql/resolvers/last_commit_resolver_spec.rb26
-rw-r--r--spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb71
-rw-r--r--spec/lib/gitlab/git/commit_spec.rb28
-rw-r--r--spec/lib/gitlab/gitaly_client/commit_service_spec.rb12
-rw-r--r--spec/lib/gitlab/tree_summary_spec.rb25
-rw-r--r--spec/models/repository_spec.rb4
-rw-r--r--spec/requests/api/files_spec.rb2
-rw-r--r--yarn.lock18
32 files changed, 260 insertions, 120 deletions
diff --git a/Gemfile b/Gemfile
index 5a6c0e13503..18519fb1720 100644
--- a/Gemfile
+++ b/Gemfile
@@ -454,7 +454,7 @@ group :ed25519 do
end
# Gitaly GRPC protocol definitions
-gem 'gitaly', '~> 13.2.0.pre.rc1'
+gem 'gitaly', '~> 13.2.0.pre.rc2'
gem 'grpc', '~> 1.24.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index db03015c1e0..fe872402b04 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -377,7 +377,7 @@ GEM
po_to_json (>= 1.0.0)
rails (>= 3.2.0)
git (1.5.0)
- gitaly (13.2.0.pre.rc1)
+ gitaly (13.2.0.pre.rc2)
grpc (~> 1.0)
github-markup (1.7.0)
gitlab-chronic (0.10.5)
@@ -1239,7 +1239,7 @@ DEPENDENCIES
gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.3)
- gitaly (~> 13.2.0.pre.rc1)
+ gitaly (~> 13.2.0.pre.rc2)
github-markup (~> 1.7.0)
gitlab-chronic (~> 0.10.5)
gitlab-labkit (= 0.12.0)
diff --git a/app/assets/javascripts/behaviors/shortcuts/shortcuts_toggle.vue b/app/assets/javascripts/behaviors/shortcuts/shortcuts_toggle.vue
index a53b1b06be9..8418c0f66ac 100644
--- a/app/assets/javascripts/behaviors/shortcuts/shortcuts_toggle.vue
+++ b/app/assets/javascripts/behaviors/shortcuts/shortcuts_toggle.vue
@@ -1,11 +1,10 @@
<script>
-import { GlToggle, GlSprintf } from '@gitlab/ui';
+import { GlToggle } from '@gitlab/ui';
import AccessorUtilities from '~/lib/utils/accessor';
import { disableShortcuts, enableShortcuts, shouldDisableShortcuts } from './shortcuts_toggle';
export default {
components: {
- GlSprintf,
GlToggle,
},
data() {
@@ -32,29 +31,10 @@ export default {
<gl-toggle
v-model="shortcutsEnabled"
aria-describedby="shortcutsToggle"
- class="prepend-left-10 mb-0"
- label-position="right"
+ label="Keyboard shortcuts"
+ label-position="left"
@change="onChange"
- >
- <template #labelOn>
- <gl-sprintf
- :message="__('%{screenreaderOnlyStart}Keyboard shorcuts%{screenreaderOnlyEnd} Enabled')"
- >
- <template #screenreaderOnly="{ content }">
- <span class="sr-only">{{ content }}</span>
- </template>
- </gl-sprintf>
- </template>
- <template #labelOff>
- <gl-sprintf
- :message="__('%{screenreaderOnlyStart}Keyboard shorcuts%{screenreaderOnlyEnd} Disabled')"
- >
- <template #screenreaderOnly="{ content }">
- <span class="sr-only">{{ content }}</span>
- </template>
- </gl-sprintf>
- </template>
- </gl-toggle>
+ />
<div id="shortcutsToggle" class="sr-only">{{ __('Enable or disable keyboard shortcuts') }}</div>
</div>
</template>
diff --git a/app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue b/app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue
index 54f5468bdd0..87c3225085f 100644
--- a/app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue
+++ b/app/assets/javascripts/clusters/components/ingress_modsecurity_settings.vue
@@ -198,13 +198,7 @@ export default {
</strong>
</p>
<div class="form-check form-check-inline mt-3">
- <gl-toggle
- v-model="modSecurityEnabled"
- :label-on="__('Enabled')"
- :label-off="__('Disabled')"
- :disabled="saveButtonDisabled"
- label-position="right"
- />
+ <gl-toggle v-model="modSecurityEnabled" :disabled="saveButtonDisabled" />
</div>
<div
v-if="ingress.modsecurity_enabled"
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb
index 804f1db4721..79c01098aa9 100644
--- a/app/controllers/projects/blob_controller.rb
+++ b/app/controllers/projects/blob_controller.rb
@@ -207,7 +207,7 @@ class Projects::BlobController < Projects::ApplicationController
def set_last_commit_sha
@last_commit_sha = Gitlab::Git::Commit
- .last_for_path(@repository, @ref, @path).sha
+ .last_for_path(@repository, @ref, @path, literal_pathspec: true).sha
end
def show_html
diff --git a/app/graphql/resolvers/last_commit_resolver.rb b/app/graphql/resolvers/last_commit_resolver.rb
index 7a433d6556f..dd89c322617 100644
--- a/app/graphql/resolvers/last_commit_resolver.rb
+++ b/app/graphql/resolvers/last_commit_resolver.rb
@@ -9,7 +9,7 @@ module Resolvers
def resolve(**args)
# Ensure merge commits can be returned by sending nil to Gitaly instead of '/'
path = tree.path == '/' ? nil : tree.path
- commit = Gitlab::Git::Commit.last_for_path(tree.repository, tree.sha, path)
+ commit = Gitlab::Git::Commit.last_for_path(tree.repository, tree.sha, path, literal_pathspec: true)
::Commit.new(commit, tree.repository.project) if commit
end
diff --git a/app/models/repository.rb b/app/models/repository.rb
index aef11936ca0..6d167700ff4 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -149,7 +149,8 @@ class Repository
before: opts[:before],
all: !!opts[:all],
first_parent: !!opts[:first_parent],
- order: opts[:order]
+ order: opts[:order],
+ literal_pathspec: opts.fetch(:literal_pathspec, true)
}
commits = Gitlab::Git::Commit.where(options)
@@ -676,8 +677,8 @@ class Repository
end
end
- def list_last_commits_for_tree(sha, path, offset: 0, limit: 25)
- commits = raw_repository.list_last_commits_for_tree(sha, path, offset: offset, limit: limit)
+ def list_last_commits_for_tree(sha, path, offset: 0, limit: 25, literal_pathspec: false)
+ commits = raw_repository.list_last_commits_for_tree(sha, path, offset: offset, limit: limit, literal_pathspec: literal_pathspec)
commits.each do |path, commit|
commits[path] = ::Commit.new(commit, container)
diff --git a/app/services/files/base_service.rb b/app/services/files/base_service.rb
index 39e614d6569..d42f718a272 100644
--- a/app/services/files/base_service.rb
+++ b/app/services/files/base_service.rb
@@ -25,7 +25,7 @@ module Files
return false unless commit_id
last_commit = Gitlab::Git::Commit
- .last_for_path(@start_project.repository, @start_branch, path)
+ .last_for_path(@start_project.repository, @start_branch, path, literal_pathspec: true)
return false unless last_commit
diff --git a/app/views/help/_shortcuts.html.haml b/app/views/help/_shortcuts.html.haml
index bd5424c30c6..3e9a77d01b4 100644
--- a/app/views/help/_shortcuts.html.haml
+++ b/app/views/help/_shortcuts.html.haml
@@ -2,10 +2,6 @@
.modal-dialog.modal-lg.modal-1040
.modal-content
.modal-header
- %h4.modal-title
- = _('Keyboard Shortcuts')
- %small
- = link_to _('(Show all)'), '#', class: 'js-more-help-button'
.js-toggle-shortcuts
%button.close{ type: "button", "data-dismiss": "modal", "aria-label" => _('Close') }
%span{ "aria-hidden": true } &times;
diff --git a/changelogs/unreleased/502-add-toggles-help-text-int-test-gitlab-ui-integration-test.yml b/changelogs/unreleased/502-add-toggles-help-text-int-test-gitlab-ui-integration-test.yml
new file mode 100644
index 00000000000..24990c85d47
--- /dev/null
+++ b/changelogs/unreleased/502-add-toggles-help-text-int-test-gitlab-ui-integration-test.yml
@@ -0,0 +1,5 @@
+---
+title: Update gl-toggles with deprecated attributes
+merge_request: 34660
+author:
+type: changed
diff --git a/changelogs/unreleased/sh-fix-gitaly-bug-2857-for-dirs.yml b/changelogs/unreleased/sh-fix-gitaly-bug-2857-for-dirs.yml
new file mode 100644
index 00000000000..dc09f0f3b53
--- /dev/null
+++ b/changelogs/unreleased/sh-fix-gitaly-bug-2857-for-dirs.yml
@@ -0,0 +1,5 @@
+---
+title: Fix directory and last commit not loading for some filenames
+merge_request: 34985
+author:
+type: fixed
diff --git a/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb b/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb
index ae8a84ff340..a25a5e2335b 100644
--- a/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb
+++ b/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers.rb
@@ -24,14 +24,25 @@ module Gitlab
#
# partition_table_by_date :audit_events, :created_at, min_date: Date.new(2020, 1), max_date: Date.new(2020, 6)
#
- # Required options are:
+ # Options are:
# :min_date - a date specifying the lower bounds of the partition range
- # :max_date - a date specifying the upper bounds of the partitioning range
+ # :max_date - a date specifying the upper bounds of the partitioning range, defaults to today + 1 month
#
- def partition_table_by_date(table_name, column_name, min_date:, max_date:)
+ # Unless min_date is specified explicitly, we default to
+ # 1. The minimum value for the partitioning column in the table
+ # 2. If no data is present yet, the current month
+ def partition_table_by_date(table_name, column_name, min_date: nil, max_date: nil)
assert_table_is_allowed(table_name)
+
assert_not_in_transaction_block(scope: ERROR_SCOPE)
+ max_date ||= Date.today + 1.month
+
+ min_date ||= connection.select_one(<<~SQL)['minimum'] || max_date - 1.month
+ SELECT date_trunc('MONTH', MIN(#{column_name})) AS minimum
+ FROM #{table_name}
+ SQL
+
raise "max_date #{max_date} must be greater than min_date #{min_date}" if min_date >= max_date
primary_key = connection.primary_key(table_name)
diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb
index 17d0a62ba8c..8db73ecc480 100644
--- a/lib/gitlab/git/commit.rb
+++ b/lib/gitlab/git/commit.rb
@@ -90,14 +90,15 @@ module Gitlab
#
# Commit.last_for_path(repo, 'master', 'Gemfile')
#
- def last_for_path(repo, ref, path = nil)
+ def last_for_path(repo, ref, path = nil, literal_pathspec: false)
# rubocop: disable Rails/FindBy
# This is not where..first from ActiveRecord
where(
repo: repo,
ref: ref,
path: path,
- limit: 1
+ limit: 1,
+ literal_pathspec: literal_pathspec
).first
# rubocop: enable Rails/FindBy
end
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 7541699dac7..a1095ff9a86 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -1002,9 +1002,9 @@ module Gitlab
end
end
- def list_last_commits_for_tree(sha, path, offset: 0, limit: 25)
+ def list_last_commits_for_tree(sha, path, offset: 0, limit: 25, literal_pathspec: false)
wrapped_gitaly_errors do
- gitaly_commit_client.list_last_commits_for_tree(sha, path, offset: offset, limit: limit)
+ gitaly_commit_client.list_last_commits_for_tree(sha, path, offset: offset, limit: limit, literal_pathspec: literal_pathspec)
end
end
diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb
index d1357aad79e..3092f1fa2b2 100644
--- a/lib/gitlab/gitaly_client/commit_service.rb
+++ b/lib/gitlab/gitaly_client/commit_service.rb
@@ -162,13 +162,14 @@ module Gitlab
[response.left_count, response.right_count]
end
- def list_last_commits_for_tree(revision, path, offset: 0, limit: 25)
+ def list_last_commits_for_tree(revision, path, offset: 0, limit: 25, literal_pathspec: false)
request = Gitaly::ListLastCommitsForTreeRequest.new(
repository: @gitaly_repo,
revision: encode_binary(revision),
path: encode_binary(path.to_s),
offset: offset,
- limit: limit
+ limit: limit,
+ global_options: parse_global_options!(literal_pathspec: literal_pathspec)
)
response = GitalyClient.call(@repository.storage, :commit_service, :list_last_commits_for_tree, request, timeout: GitalyClient.medium_timeout)
@@ -185,7 +186,7 @@ module Gitlab
repository: @gitaly_repo,
revision: encode_binary(revision),
path: encode_binary(path.to_s),
- literal_pathspec: literal_pathspec
+ global_options: parse_global_options!(literal_pathspec: literal_pathspec)
)
gitaly_commit = GitalyClient.call(@repository.storage, :commit_service, :last_commit_for_path, request, timeout: GitalyClient.fast_timeout).commit
@@ -244,14 +245,15 @@ module Gitlab
[]
end
- def commits_by_message(query, revision: '', path: '', limit: 1000, offset: 0)
+ def commits_by_message(query, revision: '', path: '', limit: 1000, offset: 0, literal_pathspec: true)
request = Gitaly::CommitsByMessageRequest.new(
repository: @gitaly_repo,
query: query,
revision: encode_binary(revision),
path: encode_binary(path),
limit: limit.to_i,
- offset: offset.to_i
+ offset: offset.to_i,
+ global_options: parse_global_options!(literal_pathspec: literal_pathspec)
)
GitalyClient.streaming_call(@repository.storage, :commit_service, :commits_by_message, request, timeout: GitalyClient.medium_timeout) do |response|
@@ -321,6 +323,7 @@ module Gitlab
skip_merges: options[:skip_merges],
all: !!options[:all],
first_parent: !!options[:first_parent],
+ global_options: parse_global_options!(options),
disable_walk: true # This option is deprecated. The 'walk' implementation is being removed.
)
request.after = GitalyClient.timestamp(options[:after]) if options[:after]
@@ -408,6 +411,11 @@ module Gitlab
private
+ def parse_global_options!(options)
+ literal_pathspec = options.delete(:literal_pathspec)
+ Gitaly::GlobalOptions.new(literal_pathspecs: literal_pathspec)
+ end
+
def call_commit_diff(request_params, options = {})
request_params[:ignore_whitespace_change] = options.fetch(:ignore_whitespace_change, false)
request_params[:enforce_limits] = options.fetch(:limits, true)
diff --git a/lib/gitlab/tree_summary.rb b/lib/gitlab/tree_summary.rb
index 4ec43e62c19..9b67599668a 100644
--- a/lib/gitlab/tree_summary.rb
+++ b/lib/gitlab/tree_summary.rb
@@ -97,7 +97,7 @@ module Gitlab
File.join(*[path, ""])
end
- commits_hsh = repository.list_last_commits_for_tree(commit.id, ensured_path, offset: offset, limit: limit)
+ commits_hsh = repository.list_last_commits_for_tree(commit.id, ensured_path, offset: offset, limit: limit, literal_pathspec: true)
prerender_commit_full_titles!(commits_hsh.values)
entries.each do |entry|
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index c8125fabb4a..f55a3fd8362 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -567,12 +567,6 @@ msgstr ""
msgid "%{retryButtonStart}Try again%{retryButtonEnd} or %{newFileButtonStart}attach a new file%{newFileButtonEnd}"
msgstr ""
-msgid "%{screenreaderOnlyStart}Keyboard shorcuts%{screenreaderOnlyEnd} Disabled"
-msgstr ""
-
-msgid "%{screenreaderOnlyStart}Keyboard shorcuts%{screenreaderOnlyEnd} Enabled"
-msgstr ""
-
msgid "%{service_title} %{message}."
msgstr ""
@@ -735,9 +729,6 @@ msgstr ""
msgid "(No changes)"
msgstr ""
-msgid "(Show all)"
-msgstr ""
-
msgid "(check progress)"
msgstr ""
@@ -11778,9 +11769,6 @@ msgstr[1] ""
msgid "Hide values"
msgstr ""
-msgid "Hiding all labels"
-msgstr ""
-
msgid "High or unknown vulnerabilities present"
msgstr ""
@@ -12941,9 +12929,6 @@ msgstr ""
msgid "Key: %{key}"
msgstr ""
-msgid "Keyboard Shortcuts"
-msgstr ""
-
msgid "Keyboard shortcuts"
msgstr ""
@@ -20565,12 +20550,6 @@ msgstr ""
msgid "Service Desk is enabled but not yet active"
msgstr ""
-msgid "Service Desk is off"
-msgstr ""
-
-msgid "Service Desk is on"
-msgstr ""
-
msgid "Service Templates"
msgstr ""
@@ -20893,9 +20872,6 @@ msgstr ""
msgid "Showing all issues"
msgstr ""
-msgid "Showing all labels"
-msgstr ""
-
msgid "Showing last %{size} of log -"
msgstr ""
diff --git a/package.json b/package.json
index 1a4b3674d43..85666922959 100644
--- a/package.json
+++ b/package.json
@@ -40,8 +40,8 @@
"@babel/plugin-syntax-import-meta": "^7.10.1",
"@babel/preset-env": "^7.10.1",
"@gitlab/at.js": "1.5.5",
- "@gitlab/svgs": "1.144.0",
- "@gitlab/ui": "17.8.0",
+ "@gitlab/svgs": "1.139.0",
+ "@gitlab/ui": "17.8.1",
"@gitlab/visual-review-tools": "1.6.1",
"@rails/actioncable": "^6.0.3-1",
"@sentry/browser": "^5.10.2",
diff --git a/qa/qa/page/component/issuable/sidebar.rb b/qa/qa/page/component/issuable/sidebar.rb
index 1bb13b4cd20..4e94049efe7 100644
--- a/qa/qa/page/component/issuable/sidebar.rb
+++ b/qa/qa/page/component/issuable/sidebar.rb
@@ -99,10 +99,6 @@ module QA
refresh
end
- def text_of_labels_block
- find_element(:labels_block)
- end
-
def toggle_more_assignees_link
click_element(:more_assignees_link)
end
diff --git a/spec/features/projects/commits/user_browses_commits_spec.rb b/spec/features/projects/commits/user_browses_commits_spec.rb
index 2796156bfbf..dee964005a4 100644
--- a/spec/features/projects/commits/user_browses_commits_spec.rb
+++ b/spec/features/projects/commits/user_browses_commits_spec.rb
@@ -137,6 +137,33 @@ RSpec.describe 'User browses commits' do
.and have_selector('entry summary', text: commit.description[0..10].delete("\r\n"))
end
+ context "when commit has a filename with pathspec characters" do
+ let(:path) { ':wq' }
+ let(:filename) { File.join(path, 'test.txt') }
+ let(:ref) { project.repository.root_ref }
+ let(:newrev) { project.repository.commit('master').sha }
+ let(:short_newrev) { project.repository.commit('master').short_id }
+ let(:message) { 'Glob characters'}
+
+ before do
+ create_file_in_repo(project, ref, ref, filename, 'Test file', commit_message: message)
+ visit project_commits_path(project, "#{ref}/#{path}", limit: 1)
+ wait_for_requests
+ end
+
+ it 'searches commit', :js do
+ expect(page).to have_content(message)
+
+ fill_in 'commits-search', with: 'bogus12345'
+
+ expect(page).to have_content "Your search didn't match any commits"
+
+ fill_in 'commits-search', with: 'Glob'
+
+ expect(page).to have_content message
+ end
+ end
+
context 'when a commit links to a confidential issue' do
let(:confidential_issue) { create(:issue, confidential: true, title: 'Secret issue!', project: project) }
diff --git a/spec/features/projects/files/user_browses_files_spec.rb b/spec/features/projects/files/user_browses_files_spec.rb
index 968cfbd17b9..e5259bd88be 100644
--- a/spec/features/projects/files/user_browses_files_spec.rb
+++ b/spec/features/projects/files/user_browses_files_spec.rb
@@ -341,7 +341,7 @@ RSpec.describe "User browses files" do
end
end
- context "when browsing a file with glob characters" do
+ context "when browsing a file with pathspec characters" do
let(:filename) { ':wq' }
let(:newrev) { project.repository.commit('master').sha }
diff --git a/spec/features/projects/tree/tree_show_spec.rb b/spec/features/projects/tree/tree_show_spec.rb
index 7e2a41ad6e6..bd2af66710a 100644
--- a/spec/features/projects/tree/tree_show_spec.rb
+++ b/spec/features/projects/tree/tree_show_spec.rb
@@ -49,10 +49,11 @@ RSpec.describe 'Projects tree', :js do
expect(page).not_to have_selector('.flash-alert')
end
- context "with a tree that contains glob characters" do
+ context "with a tree that contains pathspec characters" do
let(:path) { ':wq' }
let(:filename) { File.join(path, 'test.txt') }
let(:newrev) { project.repository.commit('master').sha }
+ let(:short_newrev) { project.repository.commit('master').short_id }
let(:message) { 'Glob characters'}
before do
@@ -61,11 +62,14 @@ RSpec.describe 'Projects tree', :js do
wait_for_requests
end
- # Disabled until https://gitlab.com/gitlab-org/gitaly/-/issues/2888 is resolved
- xit "renders tree table without errors" do
+ it "renders tree table without errors" do
expect(page).to have_selector('.tree-item')
expect(page).to have_content('test.txt')
expect(page).to have_content(message)
+
+ # Check last commit
+ expect(find('.commit-content').text).to include(message)
+ expect(find('.commit-sha-group').text).to eq(short_newrev)
end
end
diff --git a/spec/frontend/registry/shared/components/__snapshots__/expiration_policy_fields_spec.js.snap b/spec/frontend/registry/shared/components/__snapshots__/expiration_policy_fields_spec.js.snap
index a9034b81d2f..2d4f920ef3a 100644
--- a/spec/frontend/registry/shared/components/__snapshots__/expiration_policy_fields_spec.js.snap
+++ b/spec/frontend/registry/shared/components/__snapshots__/expiration_policy_fields_spec.js.snap
@@ -16,9 +16,7 @@ exports[`Expiration Policy Form renders 1`] = `
>
<gl-toggle-stub
id="expiration-policy-toggle"
- labeloff="Toggle Status: OFF"
- labelon="Toggle Status: ON"
- labelposition="hidden"
+ labelposition="top"
/>
<span
diff --git a/spec/frontend/self_monitor/components/__snapshots__/self_monitor_form_spec.js.snap b/spec/frontend/self_monitor/components/__snapshots__/self_monitor_form_spec.js.snap
index f7a9827a9ad..f4ac2f57261 100644
--- a/spec/frontend/self_monitor/components/__snapshots__/self_monitor_form_spec.js.snap
+++ b/spec/frontend/self_monitor/components/__snapshots__/self_monitor_form_spec.js.snap
@@ -47,9 +47,7 @@ exports[`self monitor component When the self monitor project has not been creat
label-for="self-monitor-toggle"
>
<gl-toggle-stub
- labeloff="Toggle Status: OFF"
- labelon="Toggle Status: ON"
- labelposition="hidden"
+ labelposition="top"
name="self-monitor-toggle"
/>
</gl-form-group-stub>
diff --git a/spec/graphql/resolvers/last_commit_resolver_spec.rb b/spec/graphql/resolvers/last_commit_resolver_spec.rb
index c891445c1ff..5ac6ad59864 100644
--- a/spec/graphql/resolvers/last_commit_resolver_spec.rb
+++ b/spec/graphql/resolvers/last_commit_resolver_spec.rb
@@ -4,8 +4,10 @@ require 'spec_helper'
RSpec.describe Resolvers::LastCommitResolver do
include GraphqlHelpers
+ include RepoHelpers
- let(:repository) { create(:project, :repository).repository }
+ let(:project) { create(:project, :repository) }
+ let(:repository) { project.repository }
let(:tree) { repository.tree(ref, path) }
let(:commit) { resolve(described_class, obj: tree) }
@@ -29,6 +31,28 @@ RSpec.describe Resolvers::LastCommitResolver do
end
end
+ context 'last commit for a wildcard pathspec' do
+ let(:ref) { 'fix' }
+ let(:path) { 'files/*' }
+
+ it 'returns nil' do
+ expect(commit).to be_nil
+ end
+ end
+
+ context 'last commit with pathspec characters' do
+ let(:ref) { 'fix' }
+ let(:path) { ':wq' }
+
+ before do
+ create_file_in_repo(project, ref, ref, path, 'Test file')
+ end
+
+ it 'resolves commit' do
+ expect(commit).to eq(repository.commits(ref, path: path, limit: 1).last)
+ end
+ end
+
context 'last commit does not exist' do
let(:ref) { 'master' }
let(:path) { 'does-not-exist' }
diff --git a/spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb b/spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb
index 3d0b314f1db..a257ca19385 100644
--- a/spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb
+++ b/spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb
@@ -173,6 +173,77 @@ RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::TableManagementHe
'202003' => ["'2020-03-01 00:00:00'", "'2020-04-01 00:00:00'"]
})
end
+
+ context 'when min_date is not given' do
+ let(:template_table) { :todos }
+
+ context 'with records present already' do
+ before do
+ create(:todo, created_at: Date.parse('2019-11-05'))
+ end
+
+ it 'creates a partition spanning over each month from the first record' do
+ migration.partition_table_by_date template_table, partition_column, max_date: max_date
+
+ expect_range_partitions_for(partitioned_table, {
+ '000000' => ['MINVALUE', "'2019-11-01 00:00:00'"],
+ '201911' => ["'2019-11-01 00:00:00'", "'2019-12-01 00:00:00'"],
+ '201912' => ["'2019-12-01 00:00:00'", "'2020-01-01 00:00:00'"],
+ '202001' => ["'2020-01-01 00:00:00'", "'2020-02-01 00:00:00'"],
+ '202002' => ["'2020-02-01 00:00:00'", "'2020-03-01 00:00:00'"],
+ '202003' => ["'2020-03-01 00:00:00'", "'2020-04-01 00:00:00'"]
+ })
+ end
+ end
+
+ context 'without data' do
+ it 'creates the catchall partition plus two actual partition' do
+ migration.partition_table_by_date template_table, partition_column, max_date: max_date
+
+ expect_range_partitions_for(partitioned_table, {
+ '000000' => ['MINVALUE', "'2020-02-01 00:00:00'"],
+ '202002' => ["'2020-02-01 00:00:00'", "'2020-03-01 00:00:00'"],
+ '202003' => ["'2020-03-01 00:00:00'", "'2020-04-01 00:00:00'"]
+ })
+ end
+ end
+ end
+
+ context 'when max_date is not given' do
+ it 'creates partitions including the next month from today' do
+ today = Date.new(2020, 5, 8)
+
+ Timecop.freeze(today) do
+ migration.partition_table_by_date template_table, partition_column, min_date: min_date
+
+ expect_range_partitions_for(partitioned_table, {
+ '000000' => ['MINVALUE', "'2019-12-01 00:00:00'"],
+ '201912' => ["'2019-12-01 00:00:00'", "'2020-01-01 00:00:00'"],
+ '202001' => ["'2020-01-01 00:00:00'", "'2020-02-01 00:00:00'"],
+ '202002' => ["'2020-02-01 00:00:00'", "'2020-03-01 00:00:00'"],
+ '202003' => ["'2020-03-01 00:00:00'", "'2020-04-01 00:00:00'"],
+ '202004' => ["'2020-04-01 00:00:00'", "'2020-05-01 00:00:00'"],
+ '202005' => ["'2020-05-01 00:00:00'", "'2020-06-01 00:00:00'"],
+ '202006' => ["'2020-06-01 00:00:00'", "'2020-07-01 00:00:00'"]
+ })
+ end
+ end
+ end
+
+ context 'without min_date, max_date' do
+ it 'creates partitions for the current and next month' do
+ current_date = Date.new(2020, 05, 22)
+ Timecop.freeze(current_date.to_time) do
+ migration.partition_table_by_date template_table, partition_column
+
+ expect_range_partitions_for(partitioned_table, {
+ '000000' => ['MINVALUE', "'2020-05-01 00:00:00'"],
+ '202005' => ["'2020-05-01 00:00:00'", "'2020-06-01 00:00:00'"],
+ '202006' => ["'2020-06-01 00:00:00'", "'2020-07-01 00:00:00'"]
+ })
+ end
+ end
+ end
end
describe 'keeping data in sync with the partitioned table' do
diff --git a/spec/lib/gitlab/git/commit_spec.rb b/spec/lib/gitlab/git/commit_spec.rb
index 27943fba60c..666b49f27f7 100644
--- a/spec/lib/gitlab/git/commit_spec.rb
+++ b/spec/lib/gitlab/git/commit_spec.rb
@@ -227,6 +227,34 @@ RSpec.describe Gitlab::Git::Commit, :seed_helper do
end
end
+ context 'pathspec' do
+ let(:pathspec) { 'files/ruby/*' }
+
+ context 'with default literal_pathspec value' do
+ it 'finds the seed commit' do
+ commit = described_class.last_for_path(repository, 'master', pathspec)
+
+ expect(commit.id).to eq(SeedRepo::Commit::ID)
+ end
+ end
+
+ context 'with literal_pathspec set to false' do
+ it 'finds the seed commit' do
+ commit = described_class.last_for_path(repository, 'master', pathspec, literal_pathspec: false)
+
+ expect(commit.id).to eq(SeedRepo::Commit::ID)
+ end
+ end
+
+ context 'with literal_pathspec set to true' do
+ it 'does not find the seed commit' do
+ commit = described_class.last_for_path(repository, 'master', pathspec, literal_pathspec: true)
+
+ expect(commit).to be_nil
+ end
+ end
+ end
+
context 'ref + path' do
subject { described_class.last_for_path(repository, SeedRepo::Commit::ID, 'encoding') }
diff --git a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
index afd63a0dbf2..35dea814789 100644
--- a/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
+++ b/spec/lib/gitlab/gitaly_client/commit_service_spec.rb
@@ -290,7 +290,8 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
request = Gitaly::FindCommitsRequest.new(
repository: repository_message,
disable_walk: true,
- order: 'NONE'
+ order: 'NONE',
+ global_options: Gitaly::GlobalOptions.new(literal_pathspecs: false)
)
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:find_commits)
@@ -303,7 +304,8 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
request = Gitaly::FindCommitsRequest.new(
repository: repository_message,
disable_walk: true,
- order: 'TOPO'
+ order: 'TOPO',
+ global_options: Gitaly::GlobalOptions.new(literal_pathspecs: false)
)
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:find_commits)
@@ -317,7 +319,8 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
repository: repository_message,
disable_walk: true,
order: 'NONE',
- author: "Billy Baggins <bilbo@shire.com>"
+ author: "Billy Baggins <bilbo@shire.com>",
+ global_options: Gitaly::GlobalOptions.new(literal_pathspecs: false)
)
expect_any_instance_of(Gitaly::CommitService::Stub).to receive(:find_commits)
@@ -338,7 +341,8 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
revision: (options[:revision] || '').dup.force_encoding(Encoding::ASCII_8BIT),
path: (options[:path] || '').dup.force_encoding(Encoding::ASCII_8BIT),
limit: (options[:limit] || 1000).to_i,
- offset: (options[:offset] || 0).to_i
+ offset: (options[:offset] || 0).to_i,
+ global_options: Gitaly::GlobalOptions.new(literal_pathspecs: true)
)
allow_any_instance_of(Gitaly::CommitService::Stub)
diff --git a/spec/lib/gitlab/tree_summary_spec.rb b/spec/lib/gitlab/tree_summary_spec.rb
index a00739f49d1..4bd08fab60a 100644
--- a/spec/lib/gitlab/tree_summary_spec.rb
+++ b/spec/lib/gitlab/tree_summary_spec.rb
@@ -47,15 +47,17 @@ RSpec.describe Gitlab::TreeSummary do
end
describe '#summarize (entries)' do
- let(:limit) { 2 }
+ let(:limit) { 4 }
custom_files = {
'a.txt' => '',
'b.txt' => '',
- 'directory/c.txt' => ''
+ 'directory/c.txt' => '',
+ ':dir/test.txt' => '',
+ ':file' => ''
}
- let(:project) { create(:project, :custom_repo, files: custom_files) }
+ let!(:project) { create(:project, :custom_repo, files: custom_files) }
let(:commit) { repo.head_commit }
subject(:entries) { summary.summarize.first }
@@ -63,13 +65,16 @@ RSpec.describe Gitlab::TreeSummary do
it 'summarizes the entries within the window' do
is_expected.to contain_exactly(
a_hash_including(type: :tree, file_name: 'directory'),
- a_hash_including(type: :blob, file_name: 'a.txt')
+ a_hash_including(type: :blob, file_name: 'a.txt'),
+ a_hash_including(type: :blob, file_name: ':file'),
+ a_hash_including(type: :tree, file_name: ':dir')
# b.txt is excluded by the limit
)
end
it 'references the commit and commit path in entries' do
- entry = entries.first
+ # There are 2 trees and the summary is not ordered
+ entry = entries.find { |entry| entry[:commit].id == commit.id }
expected_commit_path = Gitlab::Routing.url_helpers.project_commit_path(project, commit)
expect(entry[:commit]).to be_a(::Commit)
@@ -85,6 +90,14 @@ RSpec.describe Gitlab::TreeSummary do
end
end
+ context 'in a subdirectory with a pathspec character' do
+ let(:path) { ':dir' }
+
+ it 'summarizes the entries in the subdirectory' do
+ is_expected.to contain_exactly(a_hash_including(type: :blob, file_name: 'test.txt'))
+ end
+ end
+
context 'in a non-existent subdirectory' do
let(:path) { 'tmp' }
@@ -92,7 +105,7 @@ RSpec.describe Gitlab::TreeSummary do
end
context 'custom offset and limit' do
- let(:offset) { 2 }
+ let(:offset) { 4 }
it 'returns entries from the offset' do
is_expected.to contain_exactly(a_hash_including(type: :blob, file_name: 'b.txt'))
diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb
index e5d94563b5a..964cc5a13ca 100644
--- a/spec/models/repository_spec.rb
+++ b/spec/models/repository_spec.rb
@@ -253,7 +253,7 @@ RSpec.describe Repository do
end
end
- context 'with filename with glob characters' do
+ context 'with filename with pathspec characters' do
let(:filename) { ':wq' }
let(:newrev) { project.repository.commit('master').sha }
@@ -292,7 +292,7 @@ RSpec.describe Repository do
end
end
- context 'with filename with glob characters' do
+ context 'with filename with pathspec characters' do
let(:filename) { ':wq' }
let(:newrev) { project.repository.commit('master').sha }
diff --git a/spec/requests/api/files_spec.rb b/spec/requests/api/files_spec.rb
index 358eecb10c5..b50f63ed67c 100644
--- a/spec/requests/api/files_spec.rb
+++ b/spec/requests/api/files_spec.rb
@@ -185,7 +185,7 @@ RSpec.describe API::Files do
expect(response.content_type).to eq('application/json')
end
- context 'with filename with glob characters' do
+ context 'with filename with pathspec characters' do
let(:file_path) { ':wq' }
let(:newrev) { project.repository.commit('master').sha }
diff --git a/yarn.lock b/yarn.lock
index f5ca6a8ea29..6b4a307fafa 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -843,15 +843,15 @@
eslint-plugin-vue "^6.2.1"
vue-eslint-parser "^7.0.0"
-"@gitlab/svgs@1.144.0":
- version "1.144.0"
- resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.144.0.tgz#ee0ec58516405391cbaef00f5a660da6edf27538"
- integrity sha512-ejcsxoyfYwXyG8naOnn7QnY0oxrRNcWRBuH9VHrGL9/FXBJWq2NLXENi+v0TjcWvSsc2fBx/nk5V8Au96g0yEg==
-
-"@gitlab/ui@17.8.0":
- version "17.8.0"
- resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-17.8.0.tgz#187b92634d3b034f036d96238a7c39a5e7f1606b"
- integrity sha512-BwZY5D6zUilCj9Uh1nhB3VQMHsSwYxMHpz/t4qu1URIwWLeyDuEMxx6CEMT4p1Cir2eWxwxh9AauduPcmRTJPw==
+"@gitlab/svgs@1.139.0":
+ version "1.139.0"
+ resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.139.0.tgz#8a4874e76000e2dd7d3ed3a8967d62bed47d7ea7"
+ integrity sha512-o1KAmQLYL727HodlPHkmj+d+Kdw8OIgHzlKmmPYMzeE+As2l1oz6CTilca56KqXGklOgrouC9P2puMwyX8e/6g==
+
+"@gitlab/ui@17.8.1":
+ version "17.8.1"
+ resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-17.8.1.tgz#78c177f925a1bee97cf891093c0f2e606bbd7c4e"
+ integrity sha512-WzJKbX9PgdlbXEVboz1OQ30eLx9/1bOtFCIbZ9/dHEpmRu7sNK/+NlxLnQO+Ls5byAo4xk26Ykv8HDm888J7Vw==
dependencies:
"@babel/standalone" "^7.0.0"
"@gitlab/vue-toasted" "^1.3.0"