aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorXu Cheng2016-03-15 17:39:32 +0800
committerXu Cheng2016-03-21 19:07:38 +0800
commit99155c3b5fb7f956b40d35f3723bfae97c8dc06b (patch)
tree7753b012d7f9f48cae1f2630791ba86a7c354428 /Library/Homebrew
parente0e277ecded0f557b72d14b367633282b3a8c433 (diff)
downloadbrew-99155c3b5fb7f956b40d35f3723bfae97c8dc06b.tar.bz2
update: use git from ENV/scm/git
The idea is to let `scm/git` to handle all of git location resolution throughout Homebrew codebase. Closes Homebrew/homebrew#50116. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/cmd/update.sh43
1 files changed, 3 insertions, 40 deletions
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index 49df783f2..30cf94e13 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -3,42 +3,7 @@ brew() {
}
git() {
- [[ -n "$HOMEBREW_GIT" ]] || odie "HOMEBREW_GIT is unset!"
- "$HOMEBREW_GIT" "$@"
-}
-
-which_git() {
- local git_path
- local active_developer_dir
-
- if [[ -n "$HOMEBREW_GIT" ]]
- then
- git_path="$HOMEBREW_GIT"
- elif [[ -n "$GIT" ]]
- then
- git_path="$GIT"
- else
- git_path="git"
- fi
-
- git_path="$(which "$git_path" 2>/dev/null)"
-
- if [[ -n "$git_path" ]]
- then
- git_path="$(chdir "${git_path%/*}" && pwd -P)/${git_path##*/}"
- fi
-
- if [[ -n "$HOMEBREW_OSX" && "$git_path" = "/usr/bin/git" ]]
- then
- active_developer_dir="$('/usr/bin/xcode-select' -print-path 2>/dev/null)"
- if [[ -n "$active_developer_dir" && -x "$active_developer_dir/usr/bin/git" ]]
- then
- git_path="$active_developer_dir/usr/bin/git"
- else
- git_path=""
- fi
- fi
- echo "$git_path"
+ "$HOMEBREW_LIBRARY/ENV/scm/git" "$@"
}
git_init_if_necessary() {
@@ -291,12 +256,10 @@ EOS
odie "$HOMEBREW_REPOSITORY must be writable!"
fi
- HOMEBREW_GIT="$(which_git)"
- if [[ -z "$HOMEBREW_GIT" ]]
+ if ! git --version >/dev/null 2>&1
then
brew install git
- HOMEBREW_GIT="$(which_git)"
- if [[ -z "$HOMEBREW_GIT" ]]
+ if ! git --version >/dev/null 2>&1
then
odie "Git must be installed and in your PATH!"
fi