Revert "Use Homebrew's gitconfig for various commands"

This commit is contained in:
ilovezfs 2018-01-15 07:30:56 +00:00 committed by GitHub
parent 253a41f523
commit 17f80a44e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 45 deletions

View File

@ -39,6 +39,6 @@ module Homebrew
end end
args = ARGV.options_only args = ARGV.options_only
args += ["--follow", "--", path] unless path.nil? args += ["--follow", "--", path] unless path.nil?
Utils.with_homebrew_gitconfig { exec "git", "log", *args } exec "git", "log", *args
end end
end end

View File

@ -28,8 +28,6 @@ EOS
set -x set -x
fi fi
export HOME="$HOMEBREW_LIBRARY/Homebrew/gitconfig"
for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/* for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*
do do
[[ -d "$DIR/.git" ]] || continue [[ -d "$DIR/.git" ]] || continue

View File

@ -19,11 +19,7 @@ git() {
then then
GIT_EXECUTABLE="$("$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" --homebrew=print-path)" GIT_EXECUTABLE="$("$HOMEBREW_LIBRARY/Homebrew/shims/scm/git" --homebrew=print-path)"
fi fi
OLDHOME="$HOME"
export HOME="$HOMEBREW_LIBRARY/Homebrew/gitconfig"
"$GIT_EXECUTABLE" "$@" "$GIT_EXECUTABLE" "$@"
export HOME="$OLDHOME"
unset OLDHOME
} }
git_init_if_necessary() { git_init_if_necessary() {

View File

@ -793,19 +793,15 @@ class GitDownloadStrategy < VCSDownloadStrategy
def update_repo def update_repo
return unless @ref_type == :branch || !ref? return unless @ref_type == :branch || !ref?
Utils.with_homebrew_gitconfig do if !shallow_clone? && shallow_dir?
if !shallow_clone? && shallow_dir? quiet_safe_system "git", "fetch", "origin", "--unshallow"
quiet_safe_system "git", "fetch", "origin", "--unshallow" else
else quiet_safe_system "git", "fetch", "origin"
quiet_safe_system "git", "fetch", "origin"
end
end end
end end
def clone_repo def clone_repo
Utils.with_homebrew_gitconfig do safe_system "git", *clone_args
safe_system "git", *clone_args
end
cached_location.cd do cached_location.cd do
safe_system "git", "config", "homebrew.cacheversion", cache_version safe_system "git", "config", "homebrew.cacheversion", cache_version
checkout checkout
@ -815,9 +811,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
def checkout def checkout
ohai "Checking out #{@ref_type} #{@ref}" if @ref_type && @ref ohai "Checking out #{@ref_type} #{@ref}" if @ref_type && @ref
Utils.with_homebrew_gitconfig do quiet_safe_system "git", "checkout", "-f", @ref, "--"
quiet_safe_system "git", "checkout", "-f", @ref, "--"
end
end end
def reset_args def reset_args
@ -836,10 +830,8 @@ class GitDownloadStrategy < VCSDownloadStrategy
end end
def update_submodules def update_submodules
Utils.with_homebrew_gitconfig do quiet_safe_system "git", "submodule", "foreach", "--recursive", "git submodule sync"
quiet_safe_system "git", "submodule", "foreach", "--recursive", "git submodule sync" quiet_safe_system "git", "submodule", "update", "--init", "--recursive"
quiet_safe_system "git", "submodule", "update", "--init", "--recursive"
end
fix_absolute_submodule_gitdir_references! fix_absolute_submodule_gitdir_references!
end end

View File

@ -1,14 +0,0 @@
[user]
# Name used in commit messages.
name = Homebrew
# Email used in commit messages.
email = git@brew.sh
[fetch]
# Always prune when fetching (and pulling).
prune = 1
[core]
# Don't prompt for commit messages for merge commits.
mergeoptions = --no-edit
[credential]
# Use macOS Keychain to store HTTP passwords.
helper = osxkeychain

View File

@ -230,7 +230,7 @@ class Tap
ohai "Unshallowing #{name}" unless quiet ohai "Unshallowing #{name}" unless quiet
args = %w[fetch --unshallow] args = %w[fetch --unshallow]
args << "-q" if quiet args << "-q" if quiet
Utils.with_homebrew_gitconfig { path.cd { safe_system "git", *args } } path.cd { safe_system "git", *args }
return return
end end
@ -242,7 +242,7 @@ class Tap
args << "-q" if quiet args << "-q" if quiet
begin begin
Utils.with_homebrew_gitconfig { safe_system "git", *args } safe_system "git", *args
unless Readall.valid_tap?(self, aliases: true) unless Readall.valid_tap?(self, aliases: true)
unless ARGV.homebrew_developer? unless ARGV.homebrew_developer?
raise "Cannot tap #{name}: invalid syntax in tap!" raise "Cannot tap #{name}: invalid syntax in tap!"

View File

@ -60,12 +60,6 @@ module Utils
raise "Git is unavailable" unless git_available? raise "Git is unavailable" unless git_available?
end end
def self.with_homebrew_gitconfig
with_env(HOME: HOMEBREW_LIBRARY/"Homebrew/gitconfig") do
yield if block_given?
end
end
def self.clear_git_available_cache def self.clear_git_available_cache
@git = nil @git = nil
@git_path = nil @git_path = nil