Skip to content
Snippets Groups Projects
Unverified Commit f31e01c3 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

test: set Git name and email.

Extract the code from `bottle.rb` into `utils/git.rb` and ensure it's
run before we run tests.

Should resolve issues like in
https://github.com/Homebrew/homebrew-core/pull/50328
parent 27fa87c9
No related branches found
No related tags found
No related merge requests found
......@@ -558,15 +558,7 @@ module Homebrew
end
unless args.no_commit?
if ENV["HOMEBREW_GIT_NAME"]
ENV["GIT_AUTHOR_NAME"] = ENV["GIT_COMMITTER_NAME"] =
ENV["HOMEBREW_GIT_NAME"]
end
if ENV["HOMEBREW_GIT_EMAIL"]
ENV["GIT_AUTHOR_EMAIL"] = ENV["GIT_COMMITTER_EMAIL"] =
ENV["HOMEBREW_GIT_EMAIL"]
end
Utils.set_git_name_email!
short_name = formula_name.split("/", -1).last
pkg_version = bottle_hash["formula"]["pkg_version"]
......
......@@ -1744,6 +1744,7 @@ class Formula
}
ENV.clear_sensitive_environment!
Utils.set_git_name_email!
mktemp("#{name}-test") do |staging|
staging.retain! if ARGV.keep_tmp?
......
......@@ -102,4 +102,12 @@ module Utils
quiet_system "git", "ls-remote", url
end
def self.set_git_name_email!
return unless ENV["HOMEBREW_GIT_NAME"]
return unless ENV["HOMEBREW_GIT_EMAIL"]
ENV["GIT_AUTHOR_NAME"] = ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"]
ENV["GIT_AUTHOR_EMAIL"] = ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"]
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment