Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
928d9f97
Commit
928d9f97
authored
Nov 02, 2018
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into ce-to-ee-2018-11-02
parents
23960c59
c0d30fad
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
172 additions
and
28 deletions
+172
-28
CHANGELOG.md
CHANGELOG.md
+21
-0
app/assets/javascripts/commons/gitlab_ui.js
app/assets/javascripts/commons/gitlab_ui.js
+1
-2
app/assets/javascripts/sidebar/components/time_tracking/comparison_pane.vue
...ipts/sidebar/components/time_tracking/comparison_pane.vue
+4
-0
app/assets/javascripts/vue_shared/components/markdown/header.vue
...ets/javascripts/vue_shared/components/markdown/header.vue
+5
-5
app/assets/javascripts/vue_shared/components/markdown/toolbar_button.vue
...scripts/vue_shared/components/markdown/toolbar_button.vue
+5
-5
app/helpers/labels_helper.rb
app/helpers/labels_helper.rb
+1
-1
app/services/merge_requests/reload_diffs_service.rb
app/services/merge_requests/reload_diffs_service.rb
+4
-1
changelogs/unreleased/52548-links-in-tabs-of-the-labels-index-pages-ends-with-html.yml
...inks-in-tabs-of-the-labels-index-pages-ends-with-html.yml
+5
-0
changelogs/unreleased/ab-45608-stuck-mr-query.yml
changelogs/unreleased/ab-45608-stuck-mr-query.yml
+5
-0
changelogs/unreleased/gl-ui-progress-bar.yml
changelogs/unreleased/gl-ui-progress-bar.yml
+5
-0
changelogs/unreleased/kinolaev-master-patch-91872.yml
changelogs/unreleased/kinolaev-master-patch-91872.yml
+5
-0
changelogs/unreleased/replace-tooltip-in-markdown-component.yml
...logs/unreleased/replace-tooltip-in-markdown-component.yml
+5
-0
changelogs/unreleased/security-kubeclient-ssrf.yml
changelogs/unreleased/security-kubeclient-ssrf.yml
+5
-0
changelogs/unreleased/sh-optimize-reload-diffs-service.yml
changelogs/unreleased/sh-optimize-reload-diffs-service.yml
+5
-0
config/initializers/8_metrics.rb
config/initializers/8_metrics.rb
+5
-1
config/initializers/kubeclient.rb
config/initializers/kubeclient.rb
+21
-0
db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
+16
-0
db/schema.rb
db/schema.rb
+2
-1
doc/user/project/import/index.md
doc/user/project/import/index.md
+2
-1
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
+1
-1
lib/gitlab/diff/file_collection/base.rb
lib/gitlab/diff/file_collection/base.rb
+5
-2
spec/helpers/labels_helper_spec.rb
spec/helpers/labels_helper_spec.rb
+25
-0
spec/models/merge_request_diff_spec.rb
spec/models/merge_request_diff_spec.rb
+6
-6
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+2
-2
spec/services/merge_requests/reload_diffs_service_spec.rb
spec/services/merge_requests/reload_diffs_service_spec.rb
+11
-0
No files found.
CHANGELOG.md
View file @
928d9f97
...
@@ -2,6 +2,13 @@
...
@@ -2,6 +2,13 @@
documentation
](
doc/development/changelog.md
)
for instructions on adding your own
documentation
](
doc/development/changelog.md
)
for instructions on adding your own
entry.
entry.
## 11.4.4 (2018-10-30)
### Security (1 change)
-
Monkey kubeclient to not follow any redirects.
## 11.4.3 (2018-10-26)
## 11.4.3 (2018-10-26)
-
No changes.
-
No changes.
...
@@ -250,6 +257,13 @@ entry.
...
@@ -250,6 +257,13 @@ entry.
-
Check frozen string in style builds. (gfyoung)
-
Check frozen string in style builds. (gfyoung)
## 11.3.9 (2018-10-31)
### Security (1 change)
-
Monkey kubeclient to not follow any redirects.
## 11.3.8 (2018-10-27)
## 11.3.8 (2018-10-27)
-
No changes.
-
No changes.
...
@@ -556,6 +570,13 @@ entry.
...
@@ -556,6 +570,13 @@ entry.
-
Creates Vue component for artifacts block on job page.
-
Creates Vue component for artifacts block on job page.
## 11.2.8 (2018-10-31)
### Security (1 change)
-
Monkey kubeclient to not follow any redirects.
## 11.2.7 (2018-10-27)
## 11.2.7 (2018-10-27)
-
No changes.
-
No changes.
...
...
app/assets/javascripts/commons/gitlab_ui.js
View file @
928d9f97
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
{
Gl
ProgressBar
,
Gl
LoadingIcon
,
GlTooltipDirective
}
from
'
@gitlab-org/gitlab-ui
'
;
import
{
GlLoadingIcon
,
GlTooltipDirective
}
from
'
@gitlab-org/gitlab-ui
'
;
Vue
.
component
(
'
gl-progress-bar
'
,
GlProgressBar
);
Vue
.
component
(
'
gl-loading-icon
'
,
GlLoadingIcon
);
Vue
.
component
(
'
gl-loading-icon
'
,
GlLoadingIcon
);
Vue
.
directive
(
'
gl-tooltip
'
,
GlTooltipDirective
);
Vue
.
directive
(
'
gl-tooltip
'
,
GlTooltipDirective
);
app/assets/javascripts/sidebar/components/time_tracking/comparison_pane.vue
View file @
928d9f97
<
script
>
<
script
>
import
{
parseSeconds
,
stringifyTime
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
parseSeconds
,
stringifyTime
}
from
'
~/lib/utils/datetime_utility
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
import
tooltip
from
'
../../../vue_shared/directives/tooltip
'
;
import
{
GlProgressBar
}
from
'
@gitlab-org/gitlab-ui
'
;
export
default
{
export
default
{
name
:
'
TimeTrackingComparisonPane
'
,
name
:
'
TimeTrackingComparisonPane
'
,
components
:
{
GlProgressBar
,
},
directives
:
{
directives
:
{
tooltip
,
tooltip
,
},
},
...
...
app/assets/javascripts/vue_shared/components/markdown/header.vue
View file @
928d9f97
<
script
>
<
script
>
import
$
from
'
jquery
'
;
import
$
from
'
jquery
'
;
import
Tooltip
from
'
../../directives/tooltip
'
;
import
{
GlTooltipDirective
}
from
'
@gitlab-org/gitlab-ui
'
;
import
ToolbarButton
from
'
./toolbar_button.vue
'
;
import
ToolbarButton
from
'
./toolbar_button.vue
'
;
import
Icon
from
'
../icon.vue
'
;
import
Icon
from
'
../icon.vue
'
;
export
default
{
export
default
{
directives
:
{
Tooltip
,
},
components
:
{
components
:
{
ToolbarButton
,
ToolbarButton
,
Icon
,
Icon
,
},
},
directives
:
{
GlTooltip
:
GlTooltipDirective
,
},
props
:
{
props
:
{
previewMarkdown
:
{
previewMarkdown
:
{
type
:
Boolean
,
type
:
Boolean
,
...
@@ -147,7 +147,7 @@ export default {
...
@@ -147,7 +147,7 @@ export default {
icon=
"table"
icon=
"table"
/>
/>
<button
<button
v-tooltip
v-
gl-
tooltip
aria-label=
"Go full screen"
aria-label=
"Go full screen"
class=
"toolbar-btn toolbar-fullscreen-btn js-zen-enter"
class=
"toolbar-btn toolbar-fullscreen-btn js-zen-enter"
data-container=
"body"
data-container=
"body"
...
...
app/assets/javascripts/vue_shared/components/markdown/toolbar_button.vue
View file @
928d9f97
<
script
>
<
script
>
import
tooltip
from
'
../../directives/tooltip
'
;
import
{
GlTooltipDirective
}
from
'
@gitlab-org/gitlab-ui
'
;
import
i
con
from
'
../icon.vue
'
;
import
I
con
from
'
../icon.vue
'
;
export
default
{
export
default
{
components
:
{
components
:
{
i
con
,
I
con
,
},
},
directives
:
{
directives
:
{
tooltip
,
GlTooltip
:
GlTooltipDirective
,
},
},
props
:
{
props
:
{
buttonTitle
:
{
buttonTitle
:
{
...
@@ -43,7 +43,7 @@ export default {
...
@@ -43,7 +43,7 @@ export default {
<
template
>
<
template
>
<button
<button
v-tooltip
v-
gl-
tooltip
:data-md-tag=
"tag"
:data-md-tag=
"tag"
:data-md-select=
"tagSelect"
:data-md-select=
"tagSelect"
:data-md-block=
"tagBlock"
:data-md-block=
"tagBlock"
...
...
app/helpers/labels_helper.rb
View file @
928d9f97
...
@@ -143,7 +143,7 @@ module LabelsHelper
...
@@ -143,7 +143,7 @@ module LabelsHelper
def
labels_filter_path
(
options
=
{})
def
labels_filter_path
(
options
=
{})
project
=
@target_project
||
@project
project
=
@target_project
||
@project
format
=
options
.
delete
(
:format
)
||
:html
format
=
options
.
delete
(
:format
)
if
project
if
project
project_labels_path
(
project
,
format
,
options
)
project_labels_path
(
project
,
format
,
options
)
...
...
app/services/merge_requests/reload_diffs_service.rb
View file @
928d9f97
...
@@ -36,7 +36,10 @@ module MergeRequests
...
@@ -36,7 +36,10 @@ module MergeRequests
# Remove cache for all diffs on this MR. Do not use the association on the
# Remove cache for all diffs on this MR. Do not use the association on the
# model, as that will interfere with other actions happening when
# model, as that will interfere with other actions happening when
# reloading the diff.
# reloading the diff.
MergeRequestDiff
.
where
(
merge_request:
merge_request
).
each
do
|
merge_request_diff
|
MergeRequestDiff
.
where
(
merge_request:
merge_request
)
.
preload
(
merge_request: :target_project
)
.
find_each
do
|
merge_request_diff
|
next
if
merge_request_diff
==
new_diff
next
if
merge_request_diff
==
new_diff
cacheable_collection
(
merge_request_diff
).
clear_cache
cacheable_collection
(
merge_request_diff
).
clear_cache
...
...
changelogs/unreleased/52548-links-in-tabs-of-the-labels-index-pages-ends-with-html.yml
0 → 100644
View file @
928d9f97
---
title
:
Fix bug when links in tabs of the labels index pages ends with .html
merge_request
:
22716
author
:
type
:
fixed
changelogs/unreleased/ab-45608-stuck-mr-query.yml
0 → 100644
View file @
928d9f97
---
title
:
Add index to find stuck merge requests.
merge_request
:
22749
author
:
type
:
performance
changelogs/unreleased/gl-ui-progress-bar.yml
0 → 100644
View file @
928d9f97
---
title
:
Remove gitlab-ui's progress bar from global
merge_request
:
author
:
type
:
performance
changelogs/unreleased/kinolaev-master-patch-91872.yml
0 → 100644
View file @
928d9f97
---
title
:
Change HELM_HOST in Auto-DevOps template to work behind proxy
merge_request
:
22596
author
:
Sergej Nikolaev <kinolaev@gmail.com>
type
:
fixed
changelogs/unreleased/replace-tooltip-in-markdown-component.yml
0 → 100644
View file @
928d9f97
---
title
:
Replace tooltip in markdown component with gl-tooltip
merge_request
:
21989
author
:
George Tsiolis
type
:
other
changelogs/unreleased/security-kubeclient-ssrf.yml
0 → 100644
View file @
928d9f97
---
title
:
Monkey kubeclient to not follow any redirects.
merge_request
:
author
:
type
:
security
changelogs/unreleased/sh-optimize-reload-diffs-service.yml
0 → 100644
View file @
928d9f97
---
title
:
Significantly cut memory usage and SQL queries when reloading diffs
merge_request
:
22725
author
:
type
:
performance
config/initializers/8_metrics.rb
View file @
928d9f97
...
@@ -127,7 +127,11 @@ end
...
@@ -127,7 +127,11 @@ end
# check: https://github.com/rspec/rspec-mocks#settings-mocks-or-stubs-on-any-instance-of-a-class
# check: https://github.com/rspec/rspec-mocks#settings-mocks-or-stubs-on-any-instance-of-a-class
#
#
# Related issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/33587
# Related issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/33587
if
Gitlab
::
Metrics
.
enabled?
&&
!
Rails
.
env
.
test?
#
# In development mode, we turn off eager loading when we're running
# `rails generate migration` because eager loading short-circuits the
# loading of our custom migration templates.
if
Gitlab
::
Metrics
.
enabled?
&&
!
Rails
.
env
.
test?
&&
!
(
Rails
.
env
.
development?
&&
defined?
(
Rails
::
Generators
))
require
'pathname'
require
'pathname'
require
'influxdb'
require
'influxdb'
require
'connection_pool'
require
'connection_pool'
...
...
config/initializers/kubeclient.rb
View file @
928d9f97
...
@@ -13,4 +13,25 @@ class Kubeclient::Client
...
@@ -13,4 +13,25 @@ class Kubeclient::Client
ns_prefix
=
build_namespace_prefix
(
namespace
)
ns_prefix
=
build_namespace_prefix
(
namespace
)
rest_client
[
"
#{
ns_prefix
}#{
entity_name_plural
}
/
#{
name
}
:
#{
port
}
/proxy"
].
url
rest_client
[
"
#{
ns_prefix
}#{
entity_name_plural
}
/
#{
name
}
:
#{
port
}
/proxy"
].
url
end
end
# Monkey patch to set `max_redirects: 0`, so that kubeclient
# does not follow redirects and expose internal services.
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/53158
def
create_rest_client
(
path
=
nil
)
path
||=
@api_endpoint
.
path
options
=
{
ssl_ca_file:
@ssl_options
[
:ca_file
],
ssl_cert_store:
@ssl_options
[
:cert_store
],
verify_ssl:
@ssl_options
[
:verify_ssl
],
ssl_client_cert:
@ssl_options
[
:client_cert
],
ssl_client_key:
@ssl_options
[
:client_key
],
proxy:
@http_proxy_uri
,
user:
@auth_options
[
:username
],
password:
@auth_options
[
:password
],
open_timeout:
@timeouts
[
:open
],
read_timeout:
@timeouts
[
:read
],
max_redirects:
0
}
RestClient
::
Resource
.
new
(
@api_endpoint
.
merge
(
path
).
to_s
,
options
)
end
end
end
db/migrate/20181101144347_add_index_for_stuck_mr_query.rb
0 → 100644
View file @
928d9f97
# frozen_string_literal: true
class
AddIndexForStuckMrQuery
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:merge_requests
,
[
:id
,
:merge_jid
],
where:
"merge_jid IS NOT NULL and state = 'locked'"
end
def
down
remove_concurrent_index
:merge_requests
,
[
:id
,
:merge_jid
],
where:
"merge_jid IS NOT NULL and state = 'locked'"
end
end
db/schema.rb
View file @
928d9f97
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
# It's strongly recommended that you check this file into your version control system.
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
20181
031190559
)
do
ActiveRecord
::
Schema
.
define
(
version:
20181
101144347
)
do
# These are extensions that must be enabled in order to support this database
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
enable_extension
"plpgsql"
...
@@ -1759,6 +1759,7 @@ ActiveRecord::Schema.define(version: 20181031190559) do
...
@@ -1759,6 +1759,7 @@ ActiveRecord::Schema.define(version: 20181031190559) do
add_index
"merge_requests"
,
[
"created_at"
],
name:
"index_merge_requests_on_created_at"
,
using: :btree
add_index
"merge_requests"
,
[
"created_at"
],
name:
"index_merge_requests_on_created_at"
,
using: :btree
add_index
"merge_requests"
,
[
"description"
],
name:
"index_merge_requests_on_description_trigram"
,
using: :gin
,
opclasses:
{
"description"
=>
"gin_trgm_ops"
}
add_index
"merge_requests"
,
[
"description"
],
name:
"index_merge_requests_on_description_trigram"
,
using: :gin
,
opclasses:
{
"description"
=>
"gin_trgm_ops"
}
add_index
"merge_requests"
,
[
"head_pipeline_id"
],
name:
"index_merge_requests_on_head_pipeline_id"
,
using: :btree
add_index
"merge_requests"
,
[
"head_pipeline_id"
],
name:
"index_merge_requests_on_head_pipeline_id"
,
using: :btree
add_index
"merge_requests"
,
[
"id"
,
"merge_jid"
],
name:
"index_merge_requests_on_id_and_merge_jid"
,
where:
"((merge_jid IS NOT NULL) AND ((state)::text = 'locked'::text))"
,
using: :btree
add_index
"merge_requests"
,
[
"latest_merge_request_diff_id"
],
name:
"index_merge_requests_on_latest_merge_request_diff_id"
,
using: :btree
add_index
"merge_requests"
,
[
"latest_merge_request_diff_id"
],
name:
"index_merge_requests_on_latest_merge_request_diff_id"
,
using: :btree
add_index
"merge_requests"
,
[
"merge_user_id"
],
name:
"index_merge_requests_on_merge_user_id"
,
where:
"(merge_user_id IS NOT NULL)"
,
using: :btree
add_index
"merge_requests"
,
[
"merge_user_id"
],
name:
"index_merge_requests_on_merge_user_id"
,
where:
"(merge_user_id IS NOT NULL)"
,
using: :btree
add_index
"merge_requests"
,
[
"milestone_id"
],
name:
"index_merge_requests_on_milestone_id"
,
using: :btree
add_index
"merge_requests"
,
[
"milestone_id"
],
name:
"index_merge_requests_on_milestone_id"
,
using: :btree
...
...
doc/user/project/import/index.md
View file @
928d9f97
# Migrating projects to a GitLab instance
# Migrating projects to a GitLab instance
1.
[
From Bitbucket.org
](
bitbucket.md
)
1.
[
From Bitbucket Cloud (aka bitbucket.org)
](
bitbucket.md
)
1.
[
From Bitbucket Server (aka Stash)
](
bitbucket_server.md
)
1.
[
From ClearCase
](
clearcase.md
)
1.
[
From ClearCase
](
clearcase.md
)
1.
[
From CVS
](
cvs.md
)
1.
[
From CVS
](
cvs.md
)
1.
[
From FogBugz
](
fogbugz.md
)
1.
[
From FogBugz
](
fogbugz.md
)
...
...
lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml
View file @
928d9f97
...
@@ -823,7 +823,7 @@ rollout 100%:
...
@@ -823,7 +823,7 @@ rollout 100%:
function initialize_tiller() {
function initialize_tiller() {
echo "Checking Tiller..."
echo "Checking Tiller..."
export HELM_HOST=":44134"
export HELM_HOST="
localhost
:44134"
tiller -listen ${HELM_HOST} -alsologtostderr > /dev/null 2>&1 &
tiller -listen ${HELM_HOST} -alsologtostderr > /dev/null 2>&1 &
echo "Tiller is listening on ${HELM_HOST}"
echo "Tiller is listening on ${HELM_HOST}"
...
...
lib/gitlab/diff/file_collection/base.rb
View file @
928d9f97
...
@@ -17,7 +17,6 @@ module Gitlab
...
@@ -17,7 +17,6 @@ module Gitlab
@diffable
=
diffable
@diffable
=
diffable
@include_stats
=
diff_options
.
delete
(
:include_stats
)
@include_stats
=
diff_options
.
delete
(
:include_stats
)
@diffs
=
diffable
.
raw_diffs
(
diff_options
)
@project
=
project
@project
=
project
@diff_options
=
diff_options
@diff_options
=
diff_options
@diff_refs
=
diff_refs
@diff_refs
=
diff_refs
...
@@ -25,8 +24,12 @@ module Gitlab
...
@@ -25,8 +24,12 @@ module Gitlab
@repository
=
project
.
repository
@repository
=
project
.
repository
end
end
def
diffs
@diffs
||=
diffable
.
raw_diffs
(
diff_options
)
end
def
diff_files
def
diff_files
@diff_files
||=
@
diffs
.
decorate!
{
|
diff
|
decorate_diff!
(
diff
)
}
@diff_files
||=
diffs
.
decorate!
{
|
diff
|
decorate_diff!
(
diff
)
}
end
end
def
diff_file_with_old_path
(
old_path
)
def
diff_file_with_old_path
(
old_path
)
...
...
spec/helpers/labels_helper_spec.rb
View file @
928d9f97
...
@@ -211,4 +211,29 @@ describe LabelsHelper do
...
@@ -211,4 +211,29 @@ describe LabelsHelper do
end
end
end
end
end
end
describe
'labels_filter_path'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
)
}
it
'links to the dashboard labels page'
do
expect
(
labels_filter_path
).
to
eq
(
dashboard_labels_path
)
end
it
'links to the group labels page'
do
assign
(
:group
,
group
)
expect
(
helper
.
labels_filter_path
).
to
eq
(
group_labels_path
(
group
))
end
it
'links to the project labels page'
do
assign
(
:project
,
project
)
expect
(
helper
.
labels_filter_path
).
to
eq
(
project_labels_path
(
project
))
end
it
'supports json format'
do
expect
(
labels_filter_path
(
format: :json
)).
to
eq
(
dashboard_labels_path
(
format: :json
))
end
end
end
end
spec/models/merge_request_diff_spec.rb
View file @
928d9f97
...
@@ -52,9 +52,9 @@ describe MergeRequestDiff do
...
@@ -52,9 +52,9 @@ describe MergeRequestDiff do
context
'when it was not cleaned by the system'
do
context
'when it was not cleaned by the system'
do
it
'returns persisted diffs'
do
it
'returns persisted diffs'
do
expect
(
diff
).
to
receive
(
:load_diffs
)
expect
(
diff
).
to
receive
(
:load_diffs
)
.
and_call_original
diff
.
diffs
diff
.
diffs
.
diff_files
end
end
end
end
...
@@ -76,19 +76,19 @@ describe MergeRequestDiff do
...
@@ -76,19 +76,19 @@ describe MergeRequestDiff do
end
end
it
'returns persisted diffs if cannot compare with diff refs'
do
it
'returns persisted diffs if cannot compare with diff refs'
do
expect
(
diff
).
to
receive
(
:load_diffs
)
expect
(
diff
).
to
receive
(
:load_diffs
)
.
and_call_original
diff
.
update!
(
head_commit_sha:
'invalid-sha'
)
diff
.
update!
(
head_commit_sha:
'invalid-sha'
)
diff
.
diffs
diff
.
diffs
.
diff_files
end
end
it
'returns persisted diffs if diff refs does not exist'
do
it
'returns persisted diffs if diff refs does not exist'
do
expect
(
diff
).
to
receive
(
:load_diffs
)
expect
(
diff
).
to
receive
(
:load_diffs
)
.
and_call_original
diff
.
update!
(
start_commit_sha:
nil
,
base_commit_sha:
nil
)
diff
.
update!
(
start_commit_sha:
nil
,
base_commit_sha:
nil
)
diff
.
diffs
diff
.
diffs
.
diff_files
end
end
end
end
end
end
...
...
spec/models/merge_request_spec.rb
View file @
928d9f97
...
@@ -553,9 +553,9 @@ describe MergeRequest do
...
@@ -553,9 +553,9 @@ describe MergeRequest do
it
'delegates to the MR diffs'
do
it
'delegates to the MR diffs'
do
merge_request
.
save
merge_request
.
save
expect
(
merge_request
.
merge_request_diff
).
to
receive
(
:raw_diffs
).
with
(
hash_including
(
options
))
expect
(
merge_request
.
merge_request_diff
).
to
receive
(
:raw_diffs
).
with
(
hash_including
(
options
))
.
and_call_original
merge_request
.
diffs
(
options
)
merge_request
.
diffs
(
options
)
.
diff_files
end
end
end
end
...
...
spec/services/merge_requests/reload_diffs_service_spec.rb
View file @
928d9f97
...
@@ -60,6 +60,17 @@ describe MergeRequests::ReloadDiffsService, :use_clean_rails_memory_store_cachin
...
@@ -60,6 +60,17 @@ describe MergeRequests::ReloadDiffsService, :use_clean_rails_memory_store_cachin
subject
.
execute
subject
.
execute
end
end
it
'avoids N+1 queries'
,
:request_store
do
current_user
merge_request
control_count
=
ActiveRecord
::
QueryRecorder
.
new
do
subject
.
execute
end
.
count
expect
{
subject
.
execute
}.
not_to
exceed_query_limit
(
control_count
)
end
end
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment