diff --git a/Library/Homebrew/test/support/helper/env.rb b/Library/Homebrew/test/support/helper/env.rb index 6c69b335d5f1c029645882e1864789e249bfe127..7e6429e74374afcc02ce9b19079c748518fe490f 100644 --- a/Library/Homebrew/test/support/helper/env.rb +++ b/Library/Homebrew/test/support/helper/env.rb @@ -18,15 +18,15 @@ module Test end def using_git_env - initial_env = copy_env - %w[AUTHOR COMMITTER].each do |role| - ENV["GIT_#{role}_NAME"] = "brew tests" - ENV["GIT_#{role}_EMAIL"] = "brew-tests@localhost" - ENV["GIT_#{role}_DATE"] = "Thu May 21 00:04:11 2009 +0100" + git_env = ["AUTHOR", "COMMITTER"].each_with_object({}) do |role, env| + env["GIT_#{role}_NAME"] = "brew tests" + env["GIT_#{role}_EMAIL"] = "brew-tests@localhost" + env["GIT_#{role}_DATE"] = "Thu May 21 00:04:11 2009 +0100" + end + + with_environment(git_env) do + yield end - yield - ensure - restore_env initial_env end end end