summaryrefslogtreecommitdiff
path: root/lib/gitlab_shell.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2018-05-23 17:28:45 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2018-05-23 17:54:45 +0200
commitaa10b70f2a37c45bc2551f2a0d34a835dc7189f9 (patch)
treeaf08042b4c45c1bf1d76ddc2edd7193b64cf4bf0 /lib/gitlab_shell.rb
parentaa1a39a927b2810c07d23920d5035c6143d8c9cc (diff)
downloadgitlab-shell-aa10b70f2a37c45bc2551f2a0d34a835dc7189f9.tar.gz
Display the username instead of fullname
When running `ssh git@gitlab.example.com` we used to reply with the full name. But it might actually be more useful to display the username. This is unique and can help support identifying issues. Closes #131
Diffstat (limited to 'lib/gitlab_shell.rb')
-rw-r--r--lib/gitlab_shell.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb
index b38fefe..0221624 100644
--- a/lib/gitlab_shell.rb
+++ b/lib/gitlab_shell.rb
@@ -18,7 +18,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength
API_COMMANDS = %w(2fa_recovery_codes).freeze
GL_PROTOCOL = 'ssh'.freeze
- attr_accessor :key_id, :gl_repository, :repo_name, :command, :git_access, :username
+ attr_accessor :key_id, :gl_repository, :repo_name, :command, :git_access
attr_reader :repo_path
def initialize(key_id)
@@ -197,7 +197,7 @@ class GitlabShell # rubocop:disable Metrics/ClassLength
end
def username
- user && user['name'] || 'Anonymous'
+ @username ||= user && user['username'] || 'Anonymous'
end
# User identifier to be used in log messages.