Merge pull request #18749 from Homebrew/git-committer-info
Support setting `GIT_COMMITTER_NAME` and `GIT_COMMITTER_EMAIL`
This commit is contained in:
commit
1c98fcc9cc
@ -273,11 +273,19 @@ module Homebrew
|
|||||||
HOMEBREW_GITHUB_PACKAGES_USER: {
|
HOMEBREW_GITHUB_PACKAGES_USER: {
|
||||||
description: "Use this username when accessing the GitHub Packages Registry (where bottles may be stored).",
|
description: "Use this username when accessing the GitHub Packages Registry (where bottles may be stored).",
|
||||||
},
|
},
|
||||||
|
HOMEBREW_GIT_COMMITTER_EMAIL: {
|
||||||
|
description: "Set the Git committer email to this value.",
|
||||||
|
},
|
||||||
|
HOMEBREW_GIT_COMMITTER_NAME: {
|
||||||
|
description: "Set the Git committer name to this value.",
|
||||||
|
},
|
||||||
HOMEBREW_GIT_EMAIL: {
|
HOMEBREW_GIT_EMAIL: {
|
||||||
description: "Set the Git author and committer email to this value.",
|
description: "Set the Git author name and, if `HOMEBREW_GIT_COMMITTER_EMAIL` is unset, committer email to " \
|
||||||
|
"this value.",
|
||||||
},
|
},
|
||||||
HOMEBREW_GIT_NAME: {
|
HOMEBREW_GIT_NAME: {
|
||||||
description: "Set the Git author and committer name to this value.",
|
description: "Set the Git author name and, if `HOMEBREW_GIT_COMMITTER_NAME` is unset, committer name to " \
|
||||||
|
"this value.",
|
||||||
},
|
},
|
||||||
HOMEBREW_GIT_PATH: {
|
HOMEBREW_GIT_PATH: {
|
||||||
description: "Linux only: Set this value to a new enough `git` executable for Homebrew to use.",
|
description: "Linux only: Set this value to a new enough `git` executable for Homebrew to use.",
|
||||||
|
@ -160,6 +160,12 @@ module Homebrew::EnvConfig
|
|||||||
sig { returns(T.nilable(::String)) }
|
sig { returns(T.nilable(::String)) }
|
||||||
def ftp_proxy; end
|
def ftp_proxy; end
|
||||||
|
|
||||||
|
sig { returns(T.nilable(::String)) }
|
||||||
|
def git_committer_email; end
|
||||||
|
|
||||||
|
sig { returns(T.nilable(::String)) }
|
||||||
|
def git_committer_name; end
|
||||||
|
|
||||||
sig { returns(T.nilable(::String)) }
|
sig { returns(T.nilable(::String)) }
|
||||||
def git_email; end
|
def git_email; end
|
||||||
|
|
||||||
|
@ -119,12 +119,21 @@ module Utils
|
|||||||
ENV["GIT_COMMITTER_NAME"] = Homebrew::EnvConfig.git_name if committer
|
ENV["GIT_COMMITTER_NAME"] = Homebrew::EnvConfig.git_name if committer
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless Homebrew::EnvConfig.git_email
|
if Homebrew::EnvConfig.git_committer_name && committer
|
||||||
|
ENV["GIT_COMMITTER_NAME"] = Homebrew::EnvConfig.git_committer_name
|
||||||
|
end
|
||||||
|
|
||||||
|
if Homebrew::EnvConfig.git_email
|
||||||
ENV["GIT_AUTHOR_EMAIL"] = Homebrew::EnvConfig.git_email if author
|
ENV["GIT_AUTHOR_EMAIL"] = Homebrew::EnvConfig.git_email if author
|
||||||
ENV["GIT_COMMITTER_EMAIL"] = Homebrew::EnvConfig.git_email if committer
|
ENV["GIT_COMMITTER_EMAIL"] = Homebrew::EnvConfig.git_email if committer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return unless committer
|
||||||
|
return unless Homebrew::EnvConfig.git_committer_email
|
||||||
|
|
||||||
|
ENV["GIT_COMMITTER_EMAIL"] = Homebrew::EnvConfig.git_committer_email
|
||||||
|
end
|
||||||
|
|
||||||
def self.setup_gpg!
|
def self.setup_gpg!
|
||||||
gnupg_bin = HOMEBREW_PREFIX/"opt/gnupg/bin"
|
gnupg_bin = HOMEBREW_PREFIX/"opt/gnupg/bin"
|
||||||
return unless gnupg_bin.directory?
|
return unless gnupg_bin.directory?
|
||||||
|
@ -756,6 +756,7 @@ module GitHub
|
|||||||
|
|
||||||
safe_system "git", "add", *changed_files
|
safe_system "git", "add", *changed_files
|
||||||
safe_system "git", "checkout", "--no-track", "-b", branch, "#{remote}/#{remote_branch}" unless args.commit?
|
safe_system "git", "checkout", "--no-track", "-b", branch, "#{remote}/#{remote_branch}" unless args.commit?
|
||||||
|
Utils::Git.set_name_email!
|
||||||
safe_system "git", "commit", "--no-edit", "--verbose",
|
safe_system "git", "commit", "--no-edit", "--verbose",
|
||||||
"--message=#{commit_message}",
|
"--message=#{commit_message}",
|
||||||
"--", *changed_files
|
"--", *changed_files
|
||||||
|
Loading…
x
Reference in New Issue
Block a user