summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-20 12:06:01 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-20 12:06:01 +0000
commita68e9d3318c6847436f81f83eb347b29f52d1bff (patch)
tree511a790297f7e771f8d73025b9a1f9b4a0586d71
parent7bc0aff0b4e15fce828621d7e0919d84368f3d2b (diff)
downloadgitlab-ce-a68e9d3318c6847436f81f83eb347b29f52d1bff.tar.gz
Add latest changes from gitlab-org/gitlab@master
-rw-r--r--GITALY_SERVER_VERSION2
-rw-r--r--app/assets/javascripts/registry/components/table_registry.vue2
-rw-r--r--app/controllers/boards/lists_controller.rb2
-rw-r--r--app/models/concerns/milestoneish.rb2
-rw-r--r--app/models/issue.rb2
-rw-r--r--app/models/list.rb2
-rw-r--r--app/models/merge_request.rb2
-rw-r--r--app/serializers/merge_request_poll_cached_widget_entity.rb7
-rw-r--r--app/services/boards/lists/list_service.rb2
-rw-r--r--changelogs/unreleased/35873-update-container-registry-ui-to-display-correct-column-names.yml5
-rw-r--r--changelogs/unreleased/add-index-on-environment-type.yml5
-rw-r--r--changelogs/unreleased/gitaly-version-v1.73.0.yml5
-rw-r--r--changelogs/unreleased/id-mr-squash-message-performance.yml5
-rw-r--r--db/fixtures/development/02_users.rb3
-rw-r--r--db/fixtures/development/03_project.rb3
-rw-r--r--db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb21
-rw-r--r--db/schema.rb4
-rw-r--r--doc/administration/gitaly/praefect.md8
-rw-r--r--doc/user/application_security/security_dashboard/index.md2
-rw-r--r--doc/user/markdown.md17
-rw-r--r--lib/feature/gitaly.rb1
-rw-r--r--lib/gitlab/seeder.rb6
-rw-r--r--locale/gitlab.pot12
-rw-r--r--spec/frontend/registry/components/table_registry_spec.js10
-rw-r--r--spec/models/merge_request_spec.rb20
-rw-r--r--spec/requests/api/internal/base_spec.rb6
-rw-r--r--spec/serializers/merge_request_widget_entity_spec.rb26
27 files changed, 140 insertions, 42 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION
index 0834888f558..5e3a4256626 100644
--- a/GITALY_SERVER_VERSION
+++ b/GITALY_SERVER_VERSION
@@ -1 +1 @@
-1.72.0
+1.73.0
diff --git a/app/assets/javascripts/registry/components/table_registry.vue b/app/assets/javascripts/registry/components/table_registry.vue
index caa5fd4ff4e..682c511a1ae 100644
--- a/app/assets/javascripts/registry/components/table_registry.vue
+++ b/app/assets/javascripts/registry/components/table_registry.vue
@@ -196,7 +196,7 @@ export default {
/>
</th>
<th>{{ s__('ContainerRegistry|Tag') }}</th>
- <th>{{ s__('ContainerRegistry|Tag ID') }}</th>
+ <th ref="imageId">{{ s__('ContainerRegistry|Image ID') }}</th>
<th>{{ s__('ContainerRegistry|Size') }}</th>
<th>{{ s__('ContainerRegistry|Last Updated') }}</th>
<th>
diff --git a/app/controllers/boards/lists_controller.rb b/app/controllers/boards/lists_controller.rb
index 880f7500708..0b8469e8290 100644
--- a/app/controllers/boards/lists_controller.rb
+++ b/app/controllers/boards/lists_controller.rb
@@ -53,7 +53,7 @@ module Boards
service = Boards::Lists::GenerateService.new(board_parent, current_user)
if service.execute(board)
- lists = board.lists.movable.preload_associations
+ lists = board.lists.movable.preload_associated_models
List.preload_preferences_for_user(lists, current_user)
diff --git a/app/models/concerns/milestoneish.rb b/app/models/concerns/milestoneish.rb
index b1a7d7ec819..88e752e51e7 100644
--- a/app/models/concerns/milestoneish.rb
+++ b/app/models/concerns/milestoneish.rb
@@ -53,7 +53,7 @@ module Milestoneish
end
def sorted_issues(user)
- issues_visible_to_user(user).preload_associations.sort_by_attribute('label_priority')
+ issues_visible_to_user(user).preload_associated_models.sort_by_attribute('label_priority')
end
def sorted_merge_requests(user)
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 6461edbe5d5..3f3e6b2f31a 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -60,7 +60,7 @@ class Issue < ApplicationRecord
scope :order_closest_future_date, -> { reorder(Arel.sql('CASE WHEN issues.due_date >= CURRENT_DATE THEN 0 ELSE 1 END ASC, ABS(CURRENT_DATE - issues.due_date) ASC')) }
scope :order_relative_position_asc, -> { reorder(::Gitlab::Database.nulls_last_order('relative_position', 'ASC')) }
- scope :preload_associations, -> { preload(:labels, project: :namespace) }
+ scope :preload_associated_models, -> { preload(:labels, project: :namespace) }
scope :with_api_entity_associations, -> { preload(:timelogs, :assignees, :author, :notes, :labels, project: [:route, { namespace: :route }] ) }
scope :public_only, -> { where(confidential: false) }
diff --git a/app/models/list.rb b/app/models/list.rb
index 13c42b55bf7..b2ba796e3dc 100644
--- a/app/models/list.rb
+++ b/app/models/list.rb
@@ -21,7 +21,7 @@ class List < ApplicationRecord
scope :destroyable, -> { where(list_type: list_types.slice(*destroyable_types).values) }
scope :movable, -> { where(list_type: list_types.slice(*movable_types).values) }
- scope :preload_associations, -> { preload(:board, label: :priorities) }
+ scope :preload_associated_models, -> { preload(:board, label: :priorities) }
scope :ordered, -> { order(:list_type, :position) }
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 399fc030d24..a40eaa34bd1 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -1066,7 +1066,7 @@ class MergeRequest < ApplicationRecord
# Returns the oldest multi-line commit message, or the MR title if none found
def default_squash_commit_message
strong_memoize(:default_squash_commit_message) do
- commits.without_merge_commits.reverse.find(&:description?)&.safe_message || title
+ recent_commits.without_merge_commits.reverse_each.find(&:description?)&.safe_message || title
end
end
diff --git a/app/serializers/merge_request_poll_cached_widget_entity.rb b/app/serializers/merge_request_poll_cached_widget_entity.rb
index a7ff74fb888..c7dc8c43a9a 100644
--- a/app/serializers/merge_request_poll_cached_widget_entity.rb
+++ b/app/serializers/merge_request_poll_cached_widget_entity.rb
@@ -15,7 +15,7 @@ class MergeRequestPollCachedWidgetEntity < IssuableEntity
expose :target_project_id
expose :squash
expose :rebase_in_progress?, as: :rebase_in_progress
- expose :default_squash_commit_message
+ expose :default_squash_commit_message, if: -> (merge_request, _) { merge_request.mergeable? }
expose :commits_count
expose :merge_ongoing?, as: :merge_ongoing
expose :work_in_progress?, as: :work_in_progress
@@ -25,8 +25,9 @@ class MergeRequestPollCachedWidgetEntity < IssuableEntity
expose :source_branch_exists?, as: :source_branch_exists
expose :branch_missing?, as: :branch_missing
- expose :commits_without_merge_commits, using: MergeRequestWidgetCommitEntity do |merge_request|
- merge_request.commits.without_merge_commits
+ expose :commits_without_merge_commits, using: MergeRequestWidgetCommitEntity,
+ if: -> (merge_request, _) { merge_request.mergeable? } do |merge_request|
+ merge_request.recent_commits.without_merge_commits
end
expose :diff_head_sha do |merge_request|
merge_request.diff_head_sha.presence
diff --git a/app/services/boards/lists/list_service.rb b/app/services/boards/lists/list_service.rb
index 82cba1b68c4..c96ea970943 100644
--- a/app/services/boards/lists/list_service.rb
+++ b/app/services/boards/lists/list_service.rb
@@ -6,7 +6,7 @@ module Boards
def execute(board)
board.lists.create(list_type: :backlog) unless board.lists.backlog.exists?
- board.lists.preload_associations
+ board.lists.preload_associated_models
end
end
end
diff --git a/changelogs/unreleased/35873-update-container-registry-ui-to-display-correct-column-names.yml b/changelogs/unreleased/35873-update-container-registry-ui-to-display-correct-column-names.yml
new file mode 100644
index 00000000000..2ce47f3cc33
--- /dev/null
+++ b/changelogs/unreleased/35873-update-container-registry-ui-to-display-correct-column-names.yml
@@ -0,0 +1,5 @@
+---
+title: Change container registry column name from Tag ID to Image ID
+merge_request: 20349
+author:
+type: fixed
diff --git a/changelogs/unreleased/add-index-on-environment-type.yml b/changelogs/unreleased/add-index-on-environment-type.yml
new file mode 100644
index 00000000000..f50f8ac725b
--- /dev/null
+++ b/changelogs/unreleased/add-index-on-environment-type.yml
@@ -0,0 +1,5 @@
+---
+title: Replace index on environments table project_id and state with project_id, state, and environment_type
+merge_request: 19902
+author:
+type: performance
diff --git a/changelogs/unreleased/gitaly-version-v1.73.0.yml b/changelogs/unreleased/gitaly-version-v1.73.0.yml
new file mode 100644
index 00000000000..cf85ba35757
--- /dev/null
+++ b/changelogs/unreleased/gitaly-version-v1.73.0.yml
@@ -0,0 +1,5 @@
+---
+title: Upgrade to Gitaly v1.73.0
+merge_request: 20443
+author:
+type: changed
diff --git a/changelogs/unreleased/id-mr-squash-message-performance.yml b/changelogs/unreleased/id-mr-squash-message-performance.yml
new file mode 100644
index 00000000000..974c05a43c8
--- /dev/null
+++ b/changelogs/unreleased/id-mr-squash-message-performance.yml
@@ -0,0 +1,5 @@
+---
+title: Suggest squash commit messages based on recent commits
+merge_request: 20231
+author:
+type: performance
diff --git a/db/fixtures/development/02_users.rb b/db/fixtures/development/02_users.rb
index 6e0b37d7258..909d10cbb40 100644
--- a/db/fixtures/development/02_users.rb
+++ b/db/fixtures/development/02_users.rb
@@ -5,7 +5,6 @@ class Gitlab::Seeder::Users
RANDOM_USERS_COUNT = 20
MASS_USERS_COUNT = ENV['CI'] ? 10 : 1_000_000
- MASS_INSERT_USERNAME_START = 'mass_insert_user_'
attr_reader :opts
@@ -29,7 +28,7 @@ class Gitlab::Seeder::Users
ActiveRecord::Base.connection.execute <<~SQL
INSERT INTO users (username, name, email, confirmed_at, projects_limit, encrypted_password)
SELECT
- '#{MASS_INSERT_USERNAME_START}' || seq,
+ '#{Gitlab::Seeder::MASS_INSERT_USER_START}' || seq,
'Seed user ' || seq,
'seed_user' || seq || '@example.com',
to_timestamp(seq),
diff --git a/db/fixtures/development/03_project.rb b/db/fixtures/development/03_project.rb
index 87ef65276eb..19800a65cab 100644
--- a/db/fixtures/development/03_project.rb
+++ b/db/fixtures/development/03_project.rb
@@ -52,7 +52,6 @@ class Gitlab::Seeder::Projects
internal: 1, # 1m projects +
public: 1 # 1m projects = 5m total
}
- MASS_INSERT_NAME_START = 'mass_insert_project_'
def seed!
Sidekiq::Testing.inline! do
@@ -167,7 +166,7 @@ class Gitlab::Seeder::Projects
INSERT INTO projects (name, path, creator_id, namespace_id, visibility_level, created_at, updated_at)
SELECT
'Seed project ' || seq || ' ' || ('{#{visibility_per_user}}'::text[])[seq] AS project_name,
- 'mass_insert_project_' || ('{#{visibility_per_user}}'::text[])[seq] || '_' || seq AS project_path,
+ '#{Gitlab::Seeder::MASS_INSERT_PROJECT_START}' || ('{#{visibility_per_user}}'::text[])[seq] || '_' || seq AS project_path,
u.id AS user_id,
n.id AS namespace_id,
('{#{visibility_level_per_user}}'::int[])[seq] AS visibility_level,
diff --git a/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb b/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb
new file mode 100644
index 00000000000..b88a1f01d79
--- /dev/null
+++ b/db/migrate/20191118182722_add_index_to_environments_on_project_id_state_environment_type.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+class AddIndexToEnvironmentsOnProjectIdStateEnvironmentType < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+ OLD_INDEX_NAME = 'index_environments_on_project_id_and_state'.freeze
+ NEW_INDEX_NAME = 'index_environments_on_project_id_state_environment_type'.freeze
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index(:environments, [:project_id, :state, :environment_type], name: NEW_INDEX_NAME)
+ remove_concurrent_index_by_name(:environments, OLD_INDEX_NAME)
+ end
+
+ def down
+ add_concurrent_index(:environments, [:project_id, :state], name: OLD_INDEX_NAME)
+ remove_concurrent_index_by_name(:environments, NEW_INDEX_NAME)
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 63884247580..41757457a52 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 2019_11_15_091425) do
+ActiveRecord::Schema.define(version: 2019_11_18_182722) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_trgm"
@@ -1435,7 +1435,7 @@ ActiveRecord::Schema.define(version: 2019_11_15_091425) do
t.index ["name"], name: "index_environments_on_name_varchar_pattern_ops", opclass: :varchar_pattern_ops
t.index ["project_id", "name"], name: "index_environments_on_project_id_and_name", unique: true
t.index ["project_id", "slug"], name: "index_environments_on_project_id_and_slug", unique: true
- t.index ["project_id", "state"], name: "index_environments_on_project_id_and_state"
+ t.index ["project_id", "state", "environment_type"], name: "index_environments_on_project_id_state_environment_type"
end
create_table "epic_issues", id: :serial, force: :cascade do |t|
diff --git a/doc/administration/gitaly/praefect.md b/doc/administration/gitaly/praefect.md
index 667fd48a91c..1c01f3cebd5 100644
--- a/doc/administration/gitaly/praefect.md
+++ b/doc/administration/gitaly/praefect.md
@@ -20,11 +20,10 @@ for updates and roadmap.
### Architecture
-For this document, the following network topology is assumed:
+The most common architecture for Praefect is simplified in the diagram below:
```mermaid
graph TB
- GitLab --> Gitaly;
GitLab --> Praefect;
Praefect --> Gitaly-1;
Praefect --> Gitaly-2;
@@ -32,9 +31,8 @@ graph TB
```
Where `GitLab` is the collection of clients that can request Git operations.
-`Gitaly` is a Gitaly server before using Praefect. The Praefect node has three
-storage nodes attached. Praefect itself doesn't store data, but connects to
-three Gitaly nodes, `Praefect-Gitaly-1`, `Praefect-Gitaly-2`, and `Praefect-Gitaly-3`.
+The Praefect node has threestorage nodes attached. Praefect itself doesn't
+store data, but connects to three Gitaly nodes, `Gitaly-1`, `Gitaly-2`, and `Gitaly-3`.
Praefect may be enabled on its own node or can be run on the GitLab server.
In the example below we will use a separate server, but the optimal configuration
diff --git a/doc/user/application_security/security_dashboard/index.md b/doc/user/application_security/security_dashboard/index.md
index 688d231d568..7eb0d649648 100644
--- a/doc/user/application_security/security_dashboard/index.md
+++ b/doc/user/application_security/security_dashboard/index.md
@@ -71,7 +71,7 @@ Once you're on the dashboard, at the top you should see a series of filters for:
- Report type
- Project
-To the right of the filters, you should see a **Hide dismissed** toggle button ([available in GitLab Ultimate 12.5](https://gitlab.com/gitlab-org/gitlab/issues/9102)).
+To the right of the filters, you should see a **Hide dismissed** toggle button ([available for GitLab.com Gold, planned for GitLab Ultimate 12.6](https://gitlab.com/gitlab-org/gitlab/issues/9102)).
NOTE: **Note:**
The dashboard only shows projects with [security reports](#supported-reports) enabled in a group.
diff --git a/doc/user/markdown.md b/doc/user/markdown.md
index 3bd0dcafc19..0696b47ad9e 100644
--- a/doc/user/markdown.md
+++ b/doc/user/markdown.md
@@ -90,7 +90,7 @@ It makes use of [new markdown features](#new-GFM-markdown-extensions),
not found in standard markdown:
- [Color "chips" written in HEX, RGB or HSL](#colors)
-- [Diagrams and flowcharts using Mermaid](#diagrams-and-flowcharts-using-mermaid)
+- [Diagrams and flowcharts](#diagrams-and-flowcharts)
- [Emoji](#emoji)
- [Front matter](#front-matter)
- [Inline diffs](#inline-diff)
@@ -151,13 +151,16 @@ Color written inside backticks will be followed by a color "chip":
`HSL(540,70%,50%)`
`HSLA(540,70%,50%,0.3)`
-### Diagrams and flowcharts using Mermaid
+### Diagrams and flowcharts
+
+It is possible to generate diagrams and flowcharts from text in GitLab using [Mermaid](https://mermaidjs.github.io/) or [PlantUML](http://plantuml.com).
+
+#### Mermaid
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/15107) in
GitLab 10.3.
-It is possible to generate diagrams and flowcharts from text using [Mermaid](https://mermaidjs.github.io/).
-Visit the official page for more details.
+Visit the [official page](https://mermaidjs.github.io/) for more details.
In order to generate a diagram or flowchart, you should write your text inside the `mermaid` block:
@@ -179,8 +182,6 @@ graph TD;
C-->D;
```
-#### Subgraphs
-
Subgraphs can also be included:
~~~
@@ -219,6 +220,10 @@ graph TB
end
```
+#### PlantUML
+
+To make PlantUML available in GitLab, a GitLab administrator needs to enable it first. Read more in [PlantUML & GitLab](../administration/integration/plantuml.md).
+
### Emoji
> If this is not rendered correctly, [view it in GitLab itself](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/user/markdown.md#emoji).
diff --git a/lib/feature/gitaly.rb b/lib/feature/gitaly.rb
index 0ac2d017e1a..852f4899b42 100644
--- a/lib/feature/gitaly.rb
+++ b/lib/feature/gitaly.rb
@@ -9,6 +9,7 @@ class Feature
%w[
inforef_uploadpack_cache
get_all_lfs_pointers_go
+ get_tag_messages_go
].freeze
DEFAULT_ON_FLAGS = Set.new([]).freeze
diff --git a/lib/gitlab/seeder.rb b/lib/gitlab/seeder.rb
index f96346322db..53cbd5b21ea 100644
--- a/lib/gitlab/seeder.rb
+++ b/lib/gitlab/seeder.rb
@@ -16,6 +16,8 @@ module Gitlab
class Seeder
extend ActionView::Helpers::NumberHelper
+ MASS_INSERT_PROJECT_START = 'mass_insert_project_'
+ MASS_INSERT_USER_START = 'mass_insert_user_'
ESTIMATED_INSERT_PER_MINUTE = 2_000_000
MASS_INSERT_ENV = 'MASS_INSERT'
@@ -24,7 +26,7 @@ module Gitlab
included do
scope :not_mass_generated, -> do
- where.not("path LIKE '#{Gitlab::Seeder::Projects::MASS_INSERT_NAME_START}%'")
+ where.not("path LIKE '#{MASS_INSERT_PROJECT_START}%'")
end
end
end
@@ -34,7 +36,7 @@ module Gitlab
included do
scope :not_mass_generated, -> do
- where.not("username LIKE '#{Gitlab::Seeder::Users::MASS_INSERT_USERNAME_START}%'")
+ where.not("username LIKE '#{MASS_INSERT_USER_START}%'")
end
end
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index e82d513a99a..cc010936df4 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -4560,6 +4560,9 @@ msgstr ""
msgid "ContainerRegistry|If you are not already logged in, you need to authenticate to the Container Registry by using your GitLab username and password. If you have %{twofaDocLinkStart}Two-Factor Authentication%{twofaDocLinkEnd} enabled, use a %{personalAccessTokensDocLinkStart}Personal Access Token%{personalAccessTokensDocLinkEnd} instead of a password."
msgstr ""
+msgid "ContainerRegistry|Image ID"
+msgstr ""
+
msgid "ContainerRegistry|Last Updated"
msgstr ""
@@ -4583,9 +4586,6 @@ msgstr ""
msgid "ContainerRegistry|Tag"
msgstr ""
-msgid "ContainerRegistry|Tag ID"
-msgstr ""
-
msgid "ContainerRegistry|The last tag related to this image was recently removed. This empty image and any associated data will be automatically removed as part of the regular Garbage Collection process. If you have any questions, contact your administrator."
msgstr ""
@@ -15546,6 +15546,9 @@ msgstr ""
msgid "Service Desk"
msgstr ""
+msgid "Service Desk is enabled but not yet active"
+msgstr ""
+
msgid "Service Templates"
msgstr ""
@@ -19941,6 +19944,9 @@ msgstr ""
msgid "You must select a stack for configuring your cloud provider. Learn more about"
msgstr ""
+msgid "You must set up incoming email before it becomes active."
+msgstr ""
+
msgid "You need a different license to enable FileLocks feature"
msgstr ""
diff --git a/spec/frontend/registry/components/table_registry_spec.js b/spec/frontend/registry/components/table_registry_spec.js
index ab88caf44e1..b9075f565e9 100644
--- a/spec/frontend/registry/components/table_registry_spec.js
+++ b/spec/frontend/registry/components/table_registry_spec.js
@@ -25,6 +25,7 @@ describe('table registry', () => {
const findDeleteButtonsRow = (w = wrapper) => w.findAll('.js-delete-registry-row');
const findPagination = (w = wrapper) => w.find('.js-registry-pagination');
const findDeleteModal = (w = wrapper) => w.find({ ref: 'deleteModal' });
+ const findImageId = (w = wrapper) => w.find({ ref: 'imageId' });
const bulkDeletePath = 'path';
const mountWithStore = config => mount(tableRegistry, { ...config, store, localVue });
@@ -68,6 +69,15 @@ describe('table registry', () => {
expect(tds.at(3).html()).toContain(repoPropsData.list[0].size);
expect(tds.at(4).html()).toContain(wrapper.vm.timeFormated(repoPropsData.list[0].createdAt));
});
+
+ it('should have a label called Image ID', () => {
+ const label = findImageId();
+ expect(label.element).toMatchInlineSnapshot(`
+ <th>
+ Image ID
+ </th>
+ `);
+ });
});
describe('multi select', () => {
diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb
index 310f806e3d3..656753da5f1 100644
--- a/spec/models/merge_request_spec.rb
+++ b/spec/models/merge_request_spec.rb
@@ -115,8 +115,24 @@ describe MergeRequest do
let(:multiline_commits) { subject.commits.select(&is_multiline) }
let(:singleline_commits) { subject.commits.reject(&is_multiline) }
- it 'returns the oldest multiline commit message' do
- expect(subject.default_squash_commit_message).to eq(multiline_commits.last.message)
+ context 'when the total number of commits is safe' do
+ it 'returns the oldest multiline commit message' do
+ expect(subject.default_squash_commit_message).to eq(multiline_commits.last.message)
+ end
+ end
+
+ context 'when the total number of commits is big' do
+ let(:safe_number) { 20 }
+
+ before do
+ stub_const('MergeRequestDiff::COMMITS_SAFE_SIZE', safe_number)
+ end
+
+ it 'returns the oldest multiline commit message from safe number of commits' do
+ expect(subject.default_squash_commit_message).to eq(
+ "remove emtpy file.(beacase git ignore empty file)\nadd whitespace test file.\n"
+ )
+ end
end
it 'returns the merge request title if there are no multiline commits' do
diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb
index fcff2cde730..fd3d1ebee20 100644
--- a/spec/requests/api/internal/base_spec.rb
+++ b/spec/requests/api/internal/base_spec.rb
@@ -318,7 +318,7 @@ describe API::Internal::Base do
expect(json_response["gitaly"]["repository"]["relative_path"]).to eq(project.repository.gitaly_repository.relative_path)
expect(json_response["gitaly"]["address"]).to eq(Gitlab::GitalyClient.address(project.repository_storage))
expect(json_response["gitaly"]["token"]).to eq(Gitlab::GitalyClient.token(project.repository_storage))
- expect(json_response["gitaly"]["features"]).to eq('gitaly-feature-get-all-lfs-pointers-go' => 'true', 'gitaly-feature-inforef-uploadpack-cache' => 'true')
+ expect(json_response["gitaly"]["features"]).to eq('gitaly-feature-get-all-lfs-pointers-go' => 'true', 'gitaly-feature-inforef-uploadpack-cache' => 'true', 'gitaly-feature-get-tag-messages-go' => 'true')
expect(user.reload.last_activity_on).to eql(Date.today)
end
end
@@ -338,7 +338,7 @@ describe API::Internal::Base do
expect(json_response["gitaly"]["repository"]["relative_path"]).to eq(project.repository.gitaly_repository.relative_path)
expect(json_response["gitaly"]["address"]).to eq(Gitlab::GitalyClient.address(project.repository_storage))
expect(json_response["gitaly"]["token"]).to eq(Gitlab::GitalyClient.token(project.repository_storage))
- expect(json_response["gitaly"]["features"]).to eq('gitaly-feature-get-all-lfs-pointers-go' => 'true', 'gitaly-feature-inforef-uploadpack-cache' => 'true')
+ expect(json_response["gitaly"]["features"]).to eq('gitaly-feature-get-all-lfs-pointers-go' => 'true', 'gitaly-feature-inforef-uploadpack-cache' => 'true', 'gitaly-feature-get-tag-messages-go' => 'true')
expect(user.reload.last_activity_on).to be_nil
end
end
@@ -580,7 +580,7 @@ describe API::Internal::Base do
expect(json_response["gitaly"]["repository"]["relative_path"]).to eq(project.repository.gitaly_repository.relative_path)
expect(json_response["gitaly"]["address"]).to eq(Gitlab::GitalyClient.address(project.repository_storage))
expect(json_response["gitaly"]["token"]).to eq(Gitlab::GitalyClient.token(project.repository_storage))
- expect(json_response["gitaly"]["features"]).to eq('gitaly-feature-get-all-lfs-pointers-go' => 'true', 'gitaly-feature-inforef-uploadpack-cache' => 'true')
+ expect(json_response["gitaly"]["features"]).to eq('gitaly-feature-get-all-lfs-pointers-go' => 'true', 'gitaly-feature-inforef-uploadpack-cache' => 'true', 'gitaly-feature-get-tag-messages-go' => 'true')
end
end
diff --git a/spec/serializers/merge_request_widget_entity_spec.rb b/spec/serializers/merge_request_widget_entity_spec.rb
index 35940ac062e..4e79fd32215 100644
--- a/spec/serializers/merge_request_widget_entity_spec.rb
+++ b/spec/serializers/merge_request_widget_entity_spec.rb
@@ -212,9 +212,29 @@ describe MergeRequestWidgetEntity do
.to eq(resource.default_merge_commit_message(include_description: true))
end
- it 'has default_squash_commit_message' do
- expect(subject[:default_squash_commit_message])
- .to eq(resource.default_squash_commit_message)
+ describe 'attributes for squash commit message' do
+ context 'when merge request is mergeable' do
+ before do
+ stub_const('MergeRequestDiff::COMMITS_SAFE_SIZE', 20)
+ end
+
+ it 'has default_squash_commit_message and commits_without_merge_commits' do
+ expect(subject[:default_squash_commit_message])
+ .to eq(resource.default_squash_commit_message)
+ expect(subject[:commits_without_merge_commits].size).to eq(12)
+ end
+ end
+
+ context 'when merge request is not mergeable' do
+ before do
+ allow(resource).to receive(:mergeable?).and_return(false)
+ end
+
+ it 'does not have default_squash_commit_message and commits_without_merge_commits' do
+ expect(subject[:default_squash_commit_message]).to eq(nil)
+ expect(subject[:commits_without_merge_commits]).to eq(nil)
+ end
+ end
end
describe 'new_blob_path' do