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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
cb6f51ec
Commit
cb6f51ec
authored
Nov 22, 2017
by
micael.bergeron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for the commit reference filter
parent
716f9cbb
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
105 additions
and
85 deletions
+105
-85
app/assets/javascripts/diff_notes/diff_notes_bundle.js
app/assets/javascripts/diff_notes/diff_notes_bundle.js
+1
-1
app/controllers/concerns/renders_notes.rb
app/controllers/concerns/renders_notes.rb
+1
-10
app/controllers/projects/merge_requests/diffs_controller.rb
app/controllers/projects/merge_requests/diffs_controller.rb
+2
-3
app/models/commit.rb
app/models/commit.rb
+2
-1
app/models/merge_request.rb
app/models/merge_request.rb
+13
-8
app/services/system_note_service.rb
app/services/system_note_service.rb
+3
-11
app/views/projects/merge_requests/diffs/_not_all_comments_displayed.html.haml
...erge_requests/diffs/_not_all_comments_displayed.html.haml
+4
-4
lib/banzai/filter/commit_reference_filter.rb
lib/banzai/filter/commit_reference_filter.rb
+29
-9
lib/banzai/object_renderer.rb
lib/banzai/object_renderer.rb
+6
-7
lib/gitlab/diff/diff_refs.rb
lib/gitlab/diff/diff_refs.rb
+3
-19
lib/gitlab/git.rb
lib/gitlab/git.rb
+12
-0
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+1
-0
spec/controllers/projects/commit_controller_spec.rb
spec/controllers/projects/commit_controller_spec.rb
+1
-1
spec/lib/gitlab/git_spec.rb
spec/lib/gitlab/git_spec.rb
+25
-0
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+1
-1
spec/services/system_note_service_spec.rb
spec/services/system_note_service_spec.rb
+1
-10
No files found.
app/assets/javascripts/diff_notes/diff_notes_bundle.js
View file @
cb6f51ec
...
@@ -16,7 +16,7 @@ import './components/diff_note_avatars';
...
@@ -16,7 +16,7 @@ import './components/diff_note_avatars';
import
'
./components/new_issue_for_discussion
'
;
import
'
./components/new_issue_for_discussion
'
;
$
(()
=>
{
$
(()
=>
{
const
projectPathHolder
=
document
.
querySelector
(
'
.merge-request
'
)
||
document
.
querySelector
(
'
.commit-box
'
)
const
projectPathHolder
=
document
.
querySelector
(
'
.merge-request
'
)
||
document
.
querySelector
(
'
.commit-box
'
)
;
const
projectPath
=
projectPathHolder
.
dataset
.
projectPath
;
const
projectPath
=
projectPathHolder
.
dataset
.
projectPath
;
const
COMPONENT_SELECTOR
=
'
resolve-btn, resolve-discussion-btn, jump-to-discussion, comment-and-resolve-btn, new-issue-for-discussion-btn
'
;
const
COMPONENT_SELECTOR
=
'
resolve-btn, resolve-discussion-btn, jump-to-discussion, comment-and-resolve-btn, new-issue-for-discussion-btn
'
;
...
...
app/controllers/concerns/renders_notes.rb
View file @
cb6f51ec
...
@@ -3,7 +3,7 @@ module RendersNotes
...
@@ -3,7 +3,7 @@ module RendersNotes
preload_noteable_for_regular_notes
(
notes
)
preload_noteable_for_regular_notes
(
notes
)
preload_max_access_for_authors
(
notes
,
@project
)
preload_max_access_for_authors
(
notes
,
@project
)
preload_first_time_contribution_for_authors
(
noteable
,
notes
)
preload_first_time_contribution_for_authors
(
noteable
,
notes
)
Notes
::
RenderService
.
new
(
current_user
).
execute
(
notes
,
@project
,
noteable_context
(
noteable
)
)
Notes
::
RenderService
.
new
(
current_user
).
execute
(
notes
,
@project
)
notes
notes
end
end
...
@@ -26,13 +26,4 @@ module RendersNotes
...
@@ -26,13 +26,4 @@ module RendersNotes
notes
.
each
{
|
n
|
n
.
specialize_for_first_contribution!
(
noteable
)}
notes
.
each
{
|
n
|
n
.
specialize_for_first_contribution!
(
noteable
)}
end
end
def
noteable_context
(
noteable
)
case
noteable
when
MergeRequest
{
merge_request:
noteable
}
else
{}
end
end
end
end
app/controllers/projects/merge_requests/diffs_controller.rb
View file @
cb6f51ec
...
@@ -21,8 +21,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
...
@@ -21,8 +21,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
private
private
def
define_diff_vars
def
define_diff_vars
@merge_request_diffs
=
@merge_request
.
merge_request_diffs
.
viewable
.
select_without_diff
.
order_id_desc
@merge_request_diffs
=
@merge_request
.
merge_request_diffs
.
viewable
.
order_id_desc
@compare
=
commit
||
find_merge_request_diff_compare
@compare
=
commit
||
find_merge_request_diff_compare
return
render_404
unless
@compare
return
render_404
unless
@compare
...
@@ -31,7 +30,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
...
@@ -31,7 +30,7 @@ class Projects::MergeRequests::DiffsController < Projects::MergeRequests::Applic
def
commit
def
commit
return
nil
unless
commit_id
=
params
[
:commit_id
].
presence
return
nil
unless
commit_id
=
params
[
:commit_id
].
presence
return
nil
unless
@merge_request
.
all_commit
_shas
.
include?
(
commit_id
)
return
nil
unless
@merge_request
.
all_commit
s
.
exists?
(
sha:
commit_id
)
@commit
||=
@project
.
commit
(
commit_id
)
@commit
||=
@project
.
commit
(
commit_id
)
end
end
...
...
app/models/commit.rb
View file @
cb6f51ec
# coding: utf-8
class
Commit
class
Commit
extend
ActiveModel
::
Naming
extend
ActiveModel
::
Naming
extend
Gitlab
::
Cache
::
RequestCache
extend
Gitlab
::
Cache
::
RequestCache
...
@@ -25,7 +26,7 @@ class Commit
...
@@ -25,7 +26,7 @@ class Commit
DIFF_HARD_LIMIT_FILES
=
1000
DIFF_HARD_LIMIT_FILES
=
1000
DIFF_HARD_LIMIT_LINES
=
50000
DIFF_HARD_LIMIT_LINES
=
50000
MIN_SHA_LENGTH
=
7
MIN_SHA_LENGTH
=
Gitlab
::
Git
::
Commit
::
MIN_SHA_LENGTH
COMMIT_SHA_PATTERN
=
/\h{
#{
MIN_SHA_LENGTH
}
,40}/
.
freeze
COMMIT_SHA_PATTERN
=
/\h{
#{
MIN_SHA_LENGTH
}
,40}/
.
freeze
def
banzai_render_context
(
field
)
def
banzai_render_context
(
field
)
...
...
app/models/merge_request.rb
View file @
cb6f51ec
...
@@ -649,6 +649,7 @@ class MergeRequest < ActiveRecord::Base
...
@@ -649,6 +649,7 @@ class MergeRequest < ActiveRecord::Base
.
to_sql
.
to_sql
Note
.
from
(
"(
#{
union
}
)
#{
Note
.
table_name
}
"
)
Note
.
from
(
"(
#{
union
}
)
#{
Note
.
table_name
}
"
)
.
includes
(
:noteable
)
end
end
alias_method
:discussion_notes
,
:related_notes
alias_method
:discussion_notes
,
:related_notes
...
@@ -920,16 +921,13 @@ class MergeRequest < ActiveRecord::Base
...
@@ -920,16 +921,13 @@ class MergeRequest < ActiveRecord::Base
def
all_pipelines
def
all_pipelines
return
Ci
::
Pipeline
.
none
unless
source_project
return
Ci
::
Pipeline
.
none
unless
source_project
commit_shas
=
all_commits
.
unscope
(
:limit
).
select
(
:sha
)
@all_pipelines
||=
source_project
.
pipelines
@all_pipelines
||=
source_project
.
pipelines
.
where
(
sha:
all_
commit_shas
,
ref:
source_branch
)
.
where
(
sha:
commit_shas
,
ref:
source_branch
)
.
order
(
id: :desc
)
.
order
(
id: :desc
)
end
end
# Note that this could also return SHA from now dangling commits
def
all_commits
#
def
all_commit_shas
return
commit_shas
unless
persisted?
diffs_relation
=
merge_request_diffs
diffs_relation
=
merge_request_diffs
# MySQL doesn't support LIMIT in a subquery.
# MySQL doesn't support LIMIT in a subquery.
...
@@ -938,8 +936,15 @@ class MergeRequest < ActiveRecord::Base
...
@@ -938,8 +936,15 @@ class MergeRequest < ActiveRecord::Base
MergeRequestDiffCommit
MergeRequestDiffCommit
.
where
(
merge_request_diff:
diffs_relation
)
.
where
(
merge_request_diff:
diffs_relation
)
.
limit
(
10_000
)
.
limit
(
10_000
)
.
pluck
(
'sha'
)
end
.
uniq
# Note that this could also return SHA from now dangling commits
#
def
all_commit_shas
@all_commit_shas
||=
begin
return
commit_shas
unless
persisted?
all_commits
.
pluck
(
:sha
).
uniq
end
end
end
def
merge_commit
def
merge_commit
...
...
app/services/system_note_service.rb
View file @
cb6f51ec
...
@@ -23,7 +23,7 @@ module SystemNoteService
...
@@ -23,7 +23,7 @@ module SystemNoteService
body
=
"added
#{
commits_text
}
\n\n
"
body
=
"added
#{
commits_text
}
\n\n
"
body
<<
existing_commit_summary
(
noteable
,
existing_commits
,
oldrev
)
body
<<
existing_commit_summary
(
noteable
,
existing_commits
,
oldrev
)
body
<<
new_commit_summary
(
n
oteable
,
n
ew_commits
).
join
(
"
\n
"
)
body
<<
new_commit_summary
(
new_commits
).
join
(
"
\n
"
)
body
<<
"
\n\n
[Compare with previous version](
#{
diff_comparison_url
(
noteable
,
project
,
oldrev
)
}
)"
body
<<
"
\n\n
[Compare with previous version](
#{
diff_comparison_url
(
noteable
,
project
,
oldrev
)
}
)"
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'commit'
,
commit_count:
total_count
))
create_note
(
NoteSummary
.
new
(
noteable
,
project
,
author
,
body
,
action:
'commit'
,
commit_count:
total_count
))
...
@@ -486,9 +486,9 @@ module SystemNoteService
...
@@ -486,9 +486,9 @@ module SystemNoteService
# new_commits - Array of new Commit objects
# new_commits - Array of new Commit objects
#
#
# Returns an Array of Strings
# Returns an Array of Strings
def
new_commit_summary
(
merge_request
,
new_commits
)
def
new_commit_summary
(
new_commits
)
new_commits
.
collect
do
|
commit
|
new_commits
.
collect
do
|
commit
|
"*
[
#{
commit
.
short_id
}
](
#{
merge_request_commit_url
(
merge_request
,
commit
)
}
)
-
#{
escape_html
(
commit
.
title
)
}
"
"*
#{
commit
.
short_id
}
-
#{
escape_html
(
commit
.
title
)
}
"
end
end
end
end
...
@@ -668,12 +668,4 @@ module SystemNoteService
...
@@ -668,12 +668,4 @@ module SystemNoteService
start_sha:
oldrev
start_sha:
oldrev
)
)
end
end
def
merge_request_commit_url
(
merge_request
,
commit
)
url_helpers
.
diffs_project_merge_request_url
(
merge_request
.
target_project
,
merge_request
,
commit_id:
commit
)
end
end
end
app/views/projects/merge_requests/diffs/_not_all_comments_displayed.html.haml
View file @
cb6f51ec
lib/banzai/filter/commit_reference_filter.rb
View file @
cb6f51ec
...
@@ -22,19 +22,29 @@ module Banzai
...
@@ -22,19 +22,29 @@ module Banzai
end
end
end
end
def
referenced_merge_request_commit_shas
return
[]
unless
noteable
.
is_a?
(
MergeRequest
)
@referenced_merge_request_commit_shas
||=
begin
referenced_shas
=
references_per_project
.
values
.
reduce
(
:|
).
to_a
noteable
.
all_commit_shas
.
select
do
|
sha
|
referenced_shas
.
any?
{
|
ref
|
Gitlab
::
Git
.
shas_eql?
(
sha
,
ref
)
}
end
end
end
def
url_for_object
(
commit
,
project
)
def
url_for_object
(
commit
,
project
)
h
=
Gitlab
::
Routing
.
url_helpers
h
=
Gitlab
::
Routing
.
url_helpers
noteable
=
context
[
:merge_request
]
||
context
[
:noteable
]
if
noteable
.
is_a?
(
MergeRequest
)
&&
noteable
.
all_commit_shas
.
include?
(
commit
.
id
)
# the internal shas are in the context?
if
referenced_merge_request_commit_shas
.
include?
(
commit
.
id
)
# why not preload in the object?, just make sure we have the same ref
h
.
diffs_project_merge_request_url
(
project
,
# in all the rendering
noteable
,
h
.
diffs_project_merge_request_url
(
project
,
noteable
,
commit_id:
commit
.
id
)
commit_id:
commit
.
id
,
only_path:
only_path?
)
else
else
h
.
project_commit_url
(
project
,
commit
,
only_path:
context
[
:only_path
])
h
.
project_commit_url
(
project
,
commit
,
only_path:
only_path?
)
end
end
end
end
...
@@ -48,6 +58,16 @@ module Banzai
...
@@ -48,6 +58,16 @@ module Banzai
extras
extras
end
end
private
def
noteable
context
[
:noteable
]
end
def
only_path?
context
[
:only_path
]
end
end
end
end
end
end
end
lib/banzai/object_renderer.rb
View file @
cb6f51ec
...
@@ -17,11 +17,11 @@ module Banzai
...
@@ -17,11 +17,11 @@ module Banzai
# project - A Project to use for redacting Markdown.
# project - A Project to use for redacting Markdown.
# user - The user viewing the Markdown/HTML documents, if any.
# user - The user viewing the Markdown/HTML documents, if any.
# context - A Hash containing extra attributes to use during redaction
#
redaction_
context - A Hash containing extra attributes to use during redaction
def
initialize
(
project
,
user
=
nil
,
context
=
{})
def
initialize
(
project
,
user
=
nil
,
redaction_
context
=
{})
@project
=
project
@project
=
project
@user
=
user
@user
=
user
@
context
=
base_context
.
merge
(
context
)
@
redaction_context
=
base_context
.
merge
(
redaction_
context
)
end
end
# Renders and redacts an Array of objects.
# Renders and redacts an Array of objects.
...
@@ -48,8 +48,7 @@ module Banzai
...
@@ -48,8 +48,7 @@ module Banzai
pipeline
=
HTML
::
Pipeline
.
new
([])
pipeline
=
HTML
::
Pipeline
.
new
([])
objects
.
map
do
|
object
|
objects
.
map
do
|
object
|
context
=
context_for
(
object
,
attribute
)
pipeline
.
to_document
(
Banzai
.
render_field
(
object
,
attribute
))
pipeline
.
to_document
(
Banzai
.
render_field
(
object
,
attribute
,
context
))
end
end
end
end
...
@@ -74,7 +73,7 @@ module Banzai
...
@@ -74,7 +73,7 @@ module Banzai
# Returns a Banzai context for the given object and attribute.
# Returns a Banzai context for the given object and attribute.
def
context_for
(
object
,
attribute
)
def
context_for
(
object
,
attribute
)
@context
.
merge
(
object
.
banzai_render_context
(
attribute
))
@
redaction_
context
.
merge
(
object
.
banzai_render_context
(
attribute
))
end
end
def
base_context
def
base_context
...
@@ -86,7 +85,7 @@ module Banzai
...
@@ -86,7 +85,7 @@ module Banzai
end
end
def
save_options
def
save_options
return
{}
unless
@context
[
:xhtml
]
return
{}
unless
@
redaction_
context
[
:xhtml
]
{
save_with:
Nokogiri
::
XML
::
Node
::
SaveOptions
::
AS_XHTML
}
{
save_with:
Nokogiri
::
XML
::
Node
::
SaveOptions
::
AS_XHTML
}
end
end
end
end
...
...
lib/gitlab/diff/diff_refs.rb
View file @
cb6f51ec
...
@@ -13,9 +13,9 @@ module Gitlab
...
@@ -13,9 +13,9 @@ module Gitlab
def
==
(
other
)
def
==
(
other
)
other
.
is_a?
(
self
.
class
)
&&
other
.
is_a?
(
self
.
class
)
&&
shas_equa
l?
(
base_sha
,
other
.
base_sha
)
&&
Git
.
shas_eq
l?
(
base_sha
,
other
.
base_sha
)
&&
shas_equa
l?
(
start_sha
,
other
.
start_sha
)
&&
Git
.
shas_eq
l?
(
start_sha
,
other
.
start_sha
)
&&
shas_equa
l?
(
head_sha
,
other
.
head_sha
)
Git
.
shas_eq
l?
(
head_sha
,
other
.
head_sha
)
end
end
alias_method
:eql?
,
:==
alias_method
:eql?
,
:==
...
@@ -47,22 +47,6 @@ module Gitlab
...
@@ -47,22 +47,6 @@ module Gitlab
CompareService
.
new
(
project
,
head_sha
).
execute
(
project
,
start_sha
,
straight:
straight
)
CompareService
.
new
(
project
,
head_sha
).
execute
(
project
,
start_sha
,
straight:
straight
)
end
end
end
end
private
def
shas_equal?
(
sha1
,
sha2
)
return
true
if
sha1
==
sha2
return
false
if
sha1
.
nil?
||
sha2
.
nil?
return
false
unless
sha1
.
class
==
sha2
.
class
length
=
[
sha1
.
length
,
sha2
.
length
].
min
# If either of the shas is below the minimum length, we cannot be sure
# that they actually refer to the same commit because of hash collision.
return
false
if
length
<
Commit
::
MIN_SHA_LENGTH
sha1
[
0
,
length
]
==
sha2
[
0
,
length
]
end
end
end
end
end
end
end
lib/gitlab/git.rb
View file @
cb6f51ec
...
@@ -70,6 +70,18 @@ module Gitlab
...
@@ -70,6 +70,18 @@ module Gitlab
def
diff_line_code
(
file_path
,
new_line_position
,
old_line_position
)
def
diff_line_code
(
file_path
,
new_line_position
,
old_line_position
)
"
#{
Digest
::
SHA1
.
hexdigest
(
file_path
)
}
_
#{
old_line_position
}
_
#{
new_line_position
}
"
"
#{
Digest
::
SHA1
.
hexdigest
(
file_path
)
}
_
#{
old_line_position
}
_
#{
new_line_position
}
"
end
end
def
shas_eql?
(
sha1
,
sha2
)
return
false
if
sha1
.
nil?
||
sha2
.
nil?
return
false
unless
sha1
.
class
==
sha2
.
class
# If either of the shas is below the minimum length, we cannot be sure
# that they actually refer to the same commit because of hash collision.
length
=
[
sha1
.
length
,
sha2
.
length
].
min
return
false
if
length
<
Gitlab
::
Git
::
Commit
::
MIN_SHA_LENGTH
sha1
[
0
,
length
]
==
sha2
[
0
,
length
]
end
end
end
end
end
end
end
lib/gitlab/git/commit.rb
View file @
cb6f51ec
...
@@ -6,6 +6,7 @@ module Gitlab
...
@@ -6,6 +6,7 @@ module Gitlab
attr_accessor
:raw_commit
,
:head
attr_accessor
:raw_commit
,
:head
MIN_SHA_LENGTH
=
7
SERIALIZE_KEYS
=
[
SERIALIZE_KEYS
=
[
:id
,
:message
,
:parent_ids
,
:id
,
:message
,
:parent_ids
,
:authored_date
,
:author_name
,
:author_email
,
:authored_date
,
:author_name
,
:author_email
,
...
...
spec/controllers/projects/commit_controller_spec.rb
View file @
cb6f51ec
...
@@ -338,7 +338,7 @@ describe Projects::CommitController do
...
@@ -338,7 +338,7 @@ describe Projects::CommitController do
context
'when the commit does not exist'
do
context
'when the commit does not exist'
do
before
do
before
do
diff_for_path
(
id:
commit
.
id
.
succ
,
old_path:
existing_path
,
new_path:
existing_path
)
diff_for_path
(
id:
commit
.
id
.
reverse
,
old_path:
existing_path
,
new_path:
existing_path
)
end
end
it
'returns a 404'
do
it
'returns a 404'
do
...
...
spec/lib/gitlab/git_spec.rb
View file @
cb6f51ec
...
@@ -38,4 +38,29 @@ describe Gitlab::Git do
...
@@ -38,4 +38,29 @@ describe Gitlab::Git do
expect
(
described_class
.
ref_name
(
utf8_invalid_ref
)).
to
eq
(
"an_invalid_ref_å"
)
expect
(
described_class
.
ref_name
(
utf8_invalid_ref
)).
to
eq
(
"an_invalid_ref_å"
)
end
end
end
end
describe
'.shas_eql?'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:sha1
,
:sha2
,
:result
)
do
sha
=
RepoHelpers
.
sample_commit
.
id
short_sha
=
sha
[
0
,
Gitlab
::
Git
::
Commit
::
MIN_SHA_LENGTH
]
too_short_sha
=
sha
[
0
,
Gitlab
::
Git
::
Commit
::
MIN_SHA_LENGTH
-
1
]
[
[
sha
,
sha
,
true
],
[
sha
,
short_sha
,
true
],
[
sha
,
sha
.
reverse
,
false
],
[
sha
,
too_short_sha
,
false
],
[
sha
,
nil
,
false
]
]
end
with_them
do
it
{
expect
(
described_class
.
shas_eql?
(
sha1
,
sha2
)).
to
eq
(
result
)
}
it
'is commutative'
do
expect
(
described_class
.
shas_eql?
(
sha2
,
sha1
)).
to
eq
(
result
)
end
end
end
end
end
spec/models/merge_request_spec.rb
View file @
cb6f51ec
...
@@ -967,7 +967,7 @@ describe MergeRequest do
...
@@ -967,7 +967,7 @@ describe MergeRequest do
end
end
shared_examples
'returning all SHA'
do
shared_examples
'returning all SHA'
do
it
'returns all SHA from all merge_request_diffs'
do
it
'returns all SHA
s
from all merge_request_diffs'
do
expect
(
subject
.
merge_request_diffs
.
size
).
to
eq
(
2
)
expect
(
subject
.
merge_request_diffs
.
size
).
to
eq
(
2
)
expect
(
subject
.
all_commit_shas
).
to
match_array
(
all_commit_shas
)
expect
(
subject
.
all_commit_shas
).
to
match_array
(
all_commit_shas
)
end
end
...
...
spec/services/system_note_service_spec.rb
View file @
cb6f51ec
...
@@ -690,20 +690,11 @@ describe SystemNoteService do
...
@@ -690,20 +690,11 @@ describe SystemNoteService do
end
end
describe
'.new_commit_summary'
do
describe
'.new_commit_summary'
do
let
(
:merge_request
)
{
create
(
:merge_request
,
:simple
,
target_project:
project
,
source_project:
project
)
}
it
'escapes HTML titles'
do
it
'escapes HTML titles'
do
commit
=
double
(
title:
'<pre>This is a test</pre>'
,
short_id:
'12345678'
)
commit
=
double
(
title:
'<pre>This is a test</pre>'
,
short_id:
'12345678'
)
escaped
=
'<pre>This is a test</pre>'
escaped
=
'<pre>This is a test</pre>'
expect
(
described_class
.
new_commit_summary
(
merge_request
,
[
commit
])).
to
all
(
match
(
%r[-
#{
escaped
}
]
))
expect
(
described_class
.
new_commit_summary
([
commit
])).
to
all
(
match
(
%r[-
#{
escaped
}
]
))
end
it
'contains the MR diffs commit url'
do
commit
=
merge_request
.
commits
.
last
url
=
%r[/merge_requests/
#{
merge_request
.
iid
}
/diffs
\?
commit_id=
#{
commit
.
id
}
]
expect
(
described_class
.
new_commit_summary
(
merge_request
,
[
commit
])).
to
all
(
match
(
url
))
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