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
Boxiang Sun
gitlab-ce
Commits
9ad2dba2
Commit
9ad2dba2
authored
Nov 24, 2016
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Commit#author so we share logic and cache
Closes #24900
parent
7100b769
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
lib/gitlab/identifier.rb
lib/gitlab/identifier.rb
+2
-4
spec/lib/gitlab/identifier_spec.rb
spec/lib/gitlab/identifier_spec.rb
+2
-3
No files found.
lib/gitlab/identifier.rb
View file @
9ad2dba2
...
...
@@ -21,10 +21,8 @@ module Gitlab
return
if
!
commit
||
!
commit
.
author_email
email
=
commit
.
author_email
identify_with_cache
(
:email
,
email
)
do
User
.
find_by_any_email
(
email
)
identify_with_cache
(
:email
,
commit
.
author_email
)
do
commit
.
author
end
end
...
...
spec/lib/gitlab/identifier_spec.rb
View file @
9ad2dba2
...
...
@@ -40,7 +40,7 @@ describe Gitlab::Identifier do
describe
'#identify_using_commit'
do
it
"returns the User for an existing commit author's Email address"
do
commit
=
double
(
:commit
,
author_email:
user
.
email
)
commit
=
double
(
:commit
,
author
:
user
,
author
_email:
user
.
email
)
expect
(
project
).
to
receive
(
:commit
).
with
(
'123'
).
and_return
(
commit
)
...
...
@@ -62,10 +62,9 @@ describe Gitlab::Identifier do
end
it
'caches the found users per Email'
do
commit
=
double
(
:commit
,
author_email:
user
.
email
)
commit
=
double
(
:commit
,
author
:
user
,
author
_email:
user
.
email
)
expect
(
project
).
to
receive
(
:commit
).
with
(
'123'
).
twice
.
and_return
(
commit
)
expect
(
User
).
to
receive
(
:find_by_any_email
).
once
.
and_call_original
2
.
times
do
expect
(
identifier
.
identify_using_commit
(
project
,
'123'
)).
to
eq
(
user
)
...
...
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