Merge pull request #4377 from jacktose/force-brewed-git

Implement HOMEBREW_FORCE_BREWED_GIT
This commit is contained in:
Mike McQuaid 2018-06-26 19:34:44 +01:00 committed by GitHub
commit 0d33aba0b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 2 deletions

View File

@ -102,6 +102,7 @@ then
if [[ "$HOMEBREW_MACOS_VERSION_NUMERIC" -lt "100900" ]]
then
HOMEBREW_SYSTEM_GIT_TOO_OLD="1"
HOMEBREW_FORCE_BREWED_GIT="1"
fi
if [[ -z "$HOMEBREW_CACHE" ]]
@ -135,6 +136,15 @@ else
HOMEBREW_CURL="curl"
fi
if [[ -n "$HOMEBREW_FORCE_BREWED_GIT" &&
-x "$HOMEBREW_PREFIX/opt/git/bin/git" ]] &&
"$HOMEBREW_PREFIX/opt/git/bin/git" --version >/dev/null
then
HOMEBREW_GIT="$HOMEBREW_PREFIX/opt/git/bin/git"
else
HOMEBREW_GIT="git"
fi
HOMEBREW_USER_AGENT="$HOMEBREW_PRODUCT/$HOMEBREW_USER_AGENT_VERSION ($HOMEBREW_SYSTEM; $HOMEBREW_PROCESSOR $HOMEBREW_OS_USER_AGENT_VERSION)"
HOMEBREW_CURL_VERSION="$("$HOMEBREW_CURL" --version 2>/dev/null | head -n1 | awk '{print $1"/"$2}')"
HOMEBREW_USER_AGENT_CURL="$HOMEBREW_USER_AGENT $HOMEBREW_CURL_VERSION"

View File

@ -384,8 +384,8 @@ EOS
fi
if ! git --version &>/dev/null ||
[[ -n "$HOMEBREW_SYSTEM_GIT_TOO_OLD" &&
! -x "$HOMEBREW_PREFIX/opt/git/bin/git" ]]
[[ -n "$HOMEBREW_FORCE_BREWED_GIT" &&
! -x "$HOMEBREW_PREFIX/opt/git/bin/git" ]]
then
# we cannot install brewed git if homebrew/core is unavailable.
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] && brew install git

View File

@ -184,6 +184,10 @@ Note that environment variables must have a value set to be detected. For exampl
Set this to force Homebrew to use a particular git binary.
* `HOMEBREW_FORCE_BREWED_GIT`:
If set, Homebrew will use a Homebrew-installed `git` rather than the
system version.
* `HOMEBREW_GITHUB_API_TOKEN`:
A personal access token for the GitHub API, which you can create at
<https://github.com/settings/tokens>. If set, GitHub will allow you a

View File

@ -1167,6 +1167,10 @@ Note that environment variables must have a value set to be detected. For exampl
Set this to force Homebrew to use a particular git binary.
* `HOMEBREW_FORCE_BREWED_GIT`:
If set, Homebrew will use a Homebrew-installed `git` rather than the
system version.
* `HOMEBREW_GITHUB_API_TOKEN`:
A personal access token for the GitHub API, which you can create at
<https://github.com/settings/tokens>. If set, GitHub will allow you a

View File

@ -1187,6 +1187,10 @@ When using Git, Homebrew will use \fBGIT\fR if set, a Homebrew\-built Git if ins
Set this to force Homebrew to use a particular git binary\.
.
.TP
\fBHOMEBREW_FORCE_BREWED_GIT\fR
If set, Homebrew will use a Homebrew\-installed \fBgit\fR rather than the system version\.
.
.TP
\fBHOMEBREW_GITHUB_API_TOKEN\fR
A personal access token for the GitHub API, which you can create at \fIhttps://github\.com/settings/tokens\fR\. If set, GitHub will allow you a greater number of API requests\. See \fIhttps://developer\.github\.com/v3/#rate\-limiting\fR for more information\. Homebrew uses the GitHub API for features such as \fBbrew search\fR\.
.