Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
release-tools
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
release-tools
Merge requests
!197
Introduce a new CommitAuthor class
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Introduce a new CommitAuthor class
rc/introduce-commit-author
into
master
Overview
24
Commits
4
Pipelines
0
Changes
11
All threads resolved!
Hide all comments
Merged
Rémy Coutable
requested to merge
rc/introduce-commit-author
into
master
7 years ago
Overview
24
Commits
4
Pipelines
0
Changes
5
All threads resolved!
Hide all comments
Expand
This will be used in
!86 (closed)
.
0
0
Merge request reports
Compare
version 3
version 4
c9379814
7 years ago
version 3
bfee62c5
7 years ago
version 2
00297d89
7 years ago
version 1
5f4500ce
7 years ago
master (base)
and
version 4
latest version
15d4da73
4 commits,
7 years ago
version 4
c9379814
4 commits,
7 years ago
version 3
bfee62c5
2 commits,
7 years ago
version 2
00297d89
2 commits,
7 years ago
version 1
5f4500ce
1 commit,
7 years ago
Show latest version
5 files
+
85
−
76
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
lib/commit_author.rb
+
12
−
26
Options
class
CommitAuthor
# Mappings from actual Git committer names to team page's names.
# https://about.gitlab.com/team/
GIT_NAMES_TO_TEAM_PAGE_NAMES
=
{
'Luke "Jared" Bennett'
=>
"Luke 'Jared' Bennett"
,
'Achilleas Pipinellis'
=>
"Achilleas 'Axil' Pipinellis"
,
'Kamil Trzcinski'
=>
'Kamil Trzciński'
,
'Ruben Davila'
=>
'Rubén Dávila'
,
'Nick Thomas'
=>
"Nicholas 'Nick' Thomas"
,
'Lin Jen-Shin'
=>
'Jen-Shin Lin'
,
'Douglas Barbosa Alexandre'
=>
'Douglas Alexandre'
,
'Jarka Kadlecova'
=>
"Jaroslava 'Jarka' Kadlecová"
,
'Balasankar C'
=>
'Balasankar "Balu" C'
,
'winniehell'
=>
'Winnie Hellmann'
,
'kushalpandya'
=>
'Kushal Pandya'
}.
freeze
require_relative
'team'
attr_reader
:git_name
class
CommitAuthor
attr_reader
:team
,
:git_name
,
:git_names_to_team_names
def
initialize
(
git_name
)
def
initialize
(
git_name
,
team:
Team
.
new
,
git_names_to_team_names:
default_git_names_to_team_names
)
@team
=
team
@git_name
=
git_name
@git_names_to_team_names
=
git_names_to_team_names
end
def
to_gitlab
(
reference:
false
)
@@ -31,17 +19,15 @@ class CommitAuthor
private
def
gitlab_username
return
@gitlab_username
if
defined?
(
@gitlab_username
)
@gitlab_username
||=
gitlab_team
.
find_by_name
(
canonical_name
)
&
.
username
def
default_git_names_to_team_names
YAML
.
load_file
(
File
.
expand_path
(
'../git_names_to_team_names.yml'
,
__dir__
))
end
def
canonical_
name
@
canonical_name
||=
GIT_NAMES_TO_TEAM_PAGE_NAMES
.
fetch
(
git_name
,
git_name
)
def
gitlab_user
name
@
gitlab_username
||=
team
.
find_by_name
(
canonical_name
)
&
.
username
end
def
gitlab_te
am
@
gitlab_te
am
||=
Team
.
new
def
canonical_n
am
e
@
canonical_n
am
e
||=
git_names_to_team_names
.
fetch
(
git_name
,
git_name
)
end
end
Loading