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
b97a46f7
Commit
b97a46f7
authored
Aug 26, 2021
by
Jonas Wälter
Committed by
David Kim
Aug 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix signature badge on commits tab of merge request
parent
8131801a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
12 deletions
+23
-12
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+1
-1
app/models/merge_request.rb
app/models/merge_request.rb
+4
-4
app/models/merge_request_diff.rb
app/models/merge_request_diff.rb
+11
-6
spec/views/projects/merge_requests/_commits.html.haml_spec.rb
.../views/projects/merge_requests/_commits.html.haml_spec.rb
+7
-1
No files found.
app/controllers/projects/merge_requests_controller.rb
View file @
b97a46f7
...
...
@@ -176,7 +176,7 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
# or from cache if already merged
@commits
=
set_commits_for_rendering
(
@merge_request
.
recent_commits
.
with_latest_pipeline
(
@merge_request
.
source_branch
).
with_markdown_cache
,
@merge_request
.
recent_commits
(
load_from_gitaly:
true
)
.
with_latest_pipeline
(
@merge_request
.
source_branch
).
with_markdown_cache
,
commits_count:
@merge_request
.
commits_count
)
...
...
app/models/merge_request.rb
View file @
b97a46f7
...
...
@@ -615,8 +615,8 @@ class MergeRequest < ApplicationRecord
context_commits
.
count
end
def
commits
(
limit:
nil
)
return
merge_request_diff
.
commits
(
limit:
limit
)
if
merge_request_diff
.
persisted?
def
commits
(
limit:
nil
,
load_from_gitaly:
false
)
return
merge_request_diff
.
commits
(
limit:
limit
,
load_from_gitaly:
load_from_gitaly
)
if
merge_request_diff
.
persisted?
commits_arr
=
if
compare_commits
reversed_commits
=
compare_commits
.
reverse
...
...
@@ -628,8 +628,8 @@ class MergeRequest < ApplicationRecord
CommitCollection
.
new
(
source_project
,
commits_arr
,
source_branch
)
end
def
recent_commits
commits
(
limit:
MergeRequestDiff
::
COMMITS_SAFE_SIZE
)
def
recent_commits
(
load_from_gitaly:
false
)
commits
(
limit:
MergeRequestDiff
::
COMMITS_SAFE_SIZE
,
load_from_gitaly:
load_from_gitaly
)
end
def
commits_count
...
...
app/models/merge_request_diff.rb
View file @
b97a46f7
...
...
@@ -288,9 +288,9 @@ class MergeRequestDiff < ApplicationRecord
end
end
def
commits
(
limit:
nil
)
strong_memoize
(
:"commits_
#{
limit
||
'all'
}
"
)
do
load_commits
(
limit:
limit
)
def
commits
(
limit:
nil
,
load_from_gitaly:
false
)
strong_memoize
(
:"commits_
#{
limit
||
'all'
}
_
#{
load_from_gitaly
}
"
)
do
load_commits
(
limit:
limit
,
load_from_gitaly:
load_from_gitaly
)
end
end
...
...
@@ -700,9 +700,14 @@ class MergeRequestDiff < ApplicationRecord
end
end
def
load_commits
(
limit:
nil
)
commits
=
merge_request_diff_commits
.
with_users
.
limit
(
limit
)
.
map
{
|
commit
|
Commit
.
from_hash
(
commit
.
to_hash
,
project
)
}
def
load_commits
(
limit:
nil
,
load_from_gitaly:
false
)
if
load_from_gitaly
commits
=
Gitlab
::
Git
::
Commit
.
batch_by_oid
(
repository
,
merge_request_diff_commits
.
limit
(
limit
).
map
(
&
:sha
))
commits
=
Commit
.
decorate
(
commits
,
project
)
else
commits
=
merge_request_diff_commits
.
with_users
.
limit
(
limit
)
.
map
{
|
commit
|
Commit
.
from_hash
(
commit
.
to_hash
,
project
)
}
end
CommitCollection
.
new
(
merge_request
.
source_project
,
commits
,
merge_request
.
source_branch
)
...
...
spec/views/projects/merge_requests/_commits.html.haml_spec.rb
View file @
b97a46f7
...
...
@@ -21,7 +21,7 @@ RSpec.describe 'projects/merge_requests/_commits.html.haml', :sidekiq_might_not_
controller
.
prepend_view_path
(
'app/views/projects'
)
assign
(
:merge_request
,
merge_request
)
assign
(
:commits
,
merge_request
.
commits
)
assign
(
:commits
,
merge_request
.
commits
(
load_from_gitaly:
true
)
)
assign
(
:hidden_commit_count
,
0
)
end
...
...
@@ -34,6 +34,12 @@ RSpec.describe 'projects/merge_requests/_commits.html.haml', :sidekiq_might_not_
expect
(
rendered
).
to
have_link
(
href:
href
)
end
it
'shows signature verification badge'
do
render
expect
(
rendered
).
to
have_css
(
'.gpg-status-box'
)
end
context
'when there are hidden commits'
do
before
do
assign
(
:hidden_commit_count
,
1
)
...
...
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