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
b6f35556
Commit
b6f35556
authored
Jun 09, 2020
by
nmilojevic1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lazy load commit date and authored date
parent
26925041
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
2 deletions
+18
-2
changelogs/unreleased/217570-improve-performance-for-blame-api.yml
...s/unreleased/217570-improve-performance-for-blame-api.yml
+5
-0
lib/gitlab/git/commit.rb
lib/gitlab/git/commit.rb
+13
-2
No files found.
changelogs/unreleased/217570-improve-performance-for-blame-api.yml
0 → 100644
View file @
b6f35556
---
title
:
Lazy load commit_date and authored_date on Commit
merge_request
:
34181
author
:
type
:
performance
lib/gitlab/git/commit.rb
View file @
b6f35556
...
...
@@ -7,6 +7,7 @@ module Gitlab
include
Gitlab
::
EncodingHelper
prepend
Gitlab
::
Git
::
RuggedImpl
::
Commit
extend
Gitlab
::
Git
::
WrapsGitalyErrors
include
Gitlab
::
Utils
::
StrongMemoize
attr_accessor
:raw_commit
,
:head
...
...
@@ -231,6 +232,18 @@ module Gitlab
parent_ids
.
first
end
def
committed_date
strong_memoize
(
:committed_date
)
do
init_date_from_gitaly
(
raw_commit
.
committer
)
if
raw_commit
end
end
def
authored_date
strong_memoize
(
:authored_date
)
do
init_date_from_gitaly
(
raw_commit
.
author
)
if
raw_commit
end
end
# Returns a diff object for the changes from this commit's first parent.
# If there is no parent, then the diff is between this commit and an
# empty repo. See Repository#diff for keys allowed in the +options+
...
...
@@ -369,11 +382,9 @@ module Gitlab
# subject from the message to make it clearer when there's one
# available but not the other.
@message
=
message_from_gitaly_body
@authored_date
=
init_date_from_gitaly
(
commit
.
author
)
@author_name
=
commit
.
author
.
name
.
dup
@author_email
=
commit
.
author
.
email
.
dup
@committed_date
=
init_date_from_gitaly
(
commit
.
committer
)
@committer_name
=
commit
.
committer
.
name
.
dup
@committer_email
=
commit
.
committer
.
email
.
dup
@parent_ids
=
Array
(
commit
.
parent_ids
)
...
...
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