summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-08-14 12:38:08 +0200
committerAlexis Reigel <mail@koffeinfrei.org>2017-08-14 12:57:56 +0200
commita175966677edc385156eb9dab79d129ece0bb87f (patch)
tree7134d30e40bff531fa63ef311303fdcd3dd7320b
parent2c17853ac718dd516875d44da567665ed1081746 (diff)
downloadgitlab-ce-a175966677edc385156eb9dab79d129ece0bb87f.tar.gz
reset original directory in ensure
-rw-r--r--lib/gitlab/gpg.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/gitlab/gpg.rb b/lib/gitlab/gpg.rb
index 78ebd8866a1..45e9f9d65ae 100644
--- a/lib/gitlab/gpg.rb
+++ b/lib/gitlab/gpg.rb
@@ -68,17 +68,13 @@ module Gitlab
private
def optimistic_using_tmp_keychain
+ previous_dir = current_home_dir
Dir.mktmpdir do |dir|
- previous_dir = current_home_dir
-
GPGME::Engine.home_dir = dir
-
- return_value = yield
-
- GPGME::Engine.home_dir = previous_dir
-
- return_value
+ yield
end
+ ensure
+ GPGME::Engine.home_dir = previous_dir
end
end
end