From 8bd94a7304d392ad030295b5dfcd84c0100eddd1 Mon Sep 17 00:00:00 2001 From: Alexis Reigel Date: Tue, 28 Feb 2017 15:25:12 +0100 Subject: remove gpg from keychain when user's email changes --- lib/gitlab/gpg.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/gitlab/gpg.rb') 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) -- cgit v1.2.3