summaryrefslogtreecommitdiff
path: root/lib/gitlab/gpg.rb
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-02-28 15:25:12 +0100
committerAlexis Reigel <mail@koffeinfrei.org>2017-07-27 15:42:04 +0200
commit8bd94a7304d392ad030295b5dfcd84c0100eddd1 (patch)
tree0e08bcdb460ad21c25646f686a42f4b743bf0129 /lib/gitlab/gpg.rb
parentc1281982bd7975b45bed5b8e2c5ef5e242ea18fd (diff)
downloadgitlab-ce-8bd94a7304d392ad030295b5dfcd84c0100eddd1.tar.gz
remove gpg from keychain when user's email changes
Diffstat (limited to 'lib/gitlab/gpg.rb')
-rw-r--r--lib/gitlab/gpg.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/gpg.rb b/lib/gitlab/gpg.rb
index f478f1ae5d8..ee0467ae264 100644
--- a/lib/gitlab/gpg.rb
+++ b/lib/gitlab/gpg.rb
@@ -10,7 +10,9 @@ module Gitlab
end
def remove(fingerprint)
- GPGME::Key.get(fingerprint).delete!
+ # `#get` raises an EOFError if the keychain is empty, which is why we
+ # use the friendlier `#find`
+ GPGME::Key.find(:public, fingerprint).each(&:delete!)
end
def emails(fingerprint)