X Tutup
Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit 5f53fc3

Browse files
committed
update: migrate to new remote
1 parent 235d819 commit 5f53fc3

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

Library/Homebrew/cmd/update.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,36 @@ git() {
77
}
88

99
git_init_if_necessary() {
10+
if [[ -n "$HOMEBREW_OSX" ]]
11+
then
12+
OFFICIAL_REMOTE="https://github.com/Homebrew/brew.git"
13+
else
14+
OFFICIAL_REMOTE="https://github.com/Linuxbrew/brew.git"
15+
fi
16+
1017
if [[ ! -d ".git" ]]
1118
then
1219
set -e
1320
trap '{ rm -rf .git; exit 1; }' EXIT
1421
git init
1522
git config --bool core.autocrlf false
16-
git config remote.origin.url https://github.com/Homebrew/homebrew.git
23+
git config remote.origin.url "$OFFICIAL_REMOTE"
1724
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
1825
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
1926
git reset --hard origin/master
2027
SKIP_FETCH_HOMEBREW_REPOSITORY=1
2128
set +e
2229
trap - EXIT
23-
return
24-
fi
25-
26-
if [[ "$(git remote show origin -n)" = *"mxcl/homebrew"* ]]
27-
then
28-
git remote set-url origin https://github.com/Homebrew/homebrew.git &&
29-
git remote set-url --delete origin ".*mxcl\/homebrew.*"
30+
else
31+
set -e
32+
git config --bool core.autocrlf false
33+
git config --replace-all remote.origin.url "$OFFICIAL_REMOTE"
34+
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
35+
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master
36+
git reset --hard origin/master
37+
git gc --auto
38+
SKIP_FETCH_HOMEBREW_REPOSITORY=1
39+
set +e
3040
fi
3141
}
3242

0 commit comments

Comments
 (0)
X Tutup