aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/update-bash.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/update-bash.sh b/Library/Homebrew/cmd/update-bash.sh
index 47b811e4b..8c0c0e3ef 100644
--- a/Library/Homebrew/cmd/update-bash.sh
+++ b/Library/Homebrew/cmd/update-bash.sh
@@ -21,17 +21,26 @@ which_git() {
}
git_init_if_necessary() {
+ set -e
+ trap '{ rm -rf .git; exit 1; }' EXIT
+
if [[ ! -d ".git" ]]
then
git init -q
git config --bool core.autocrlf false
git config remote.origin.url https://github.com/Homebrew/homebrew.git
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
+ git fetch origin
+ git reset --hard origin/master
+ SKIP_FETCH_HOMEBREW_REPOSITORY=1
fi
+ set +e
+ trap - EXIT
+
if [[ "$(git remote show origin -n)" = *"mxcl/homebrew"* ]]
then
- git remote set-url origin https://github.com/Homebrew/homebrew.git
+ git remote set-url origin https://github.com/Homebrew/homebrew.git &&
git remote set-url --delete origin ".*mxcl\/homebrew.*"
fi
}
@@ -295,6 +304,7 @@ EOS
for DIR in "$HOMEBREW_REPOSITORY" "$HOMEBREW_LIBRARY"/Taps/*/*
do
[[ -d "$DIR/.git" ]] || continue
+ [[ -n "$SKIP_FETCH_HOMEBREW_REPOSITORY" && "$DIR" = "$HOMEBREW_REPOSITORY" ]] && continue
cd "$DIR" || continue
UPSTREAM_BRANCH="$(upstream_branch)"
# the refspec ensures that the default upstream branch gets updated