diff options
| author | Xu Cheng | 2016-03-09 17:09:38 +0800 |
|---|---|---|
| committer | Xu Cheng | 2016-03-09 19:47:26 +0800 |
| commit | 0f6def90b7993fdb587b06207d88f3b818be9c6c (patch) | |
| tree | cf0bcde29e15c995fd755aca6ca9882a48ec1243 /Library | |
| parent | e8caa48cc2858815ef3193d461fb12c2ba8bda07 (diff) | |
| download | brew-0f6def90b7993fdb587b06207d88f3b818be9c6c.tar.bz2 | |
update: shallow fetch for git_init_if_necessary
Users shouldn't need to fetch all of git history.
Closes Homebrew/homebrew#49903.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/update.sh | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index 07847a0ba..13bce9909 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -42,23 +42,22 @@ which_git() { } git_init_if_necessary() { - set -e - trap '{ rm -rf .git; exit 1; }' EXIT - if [[ ! -d ".git" ]] then + set -e + trap '{ rm -rf .git; exit 1; }' EXIT git init 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 fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master git reset --hard origin/master SKIP_FETCH_HOMEBREW_REPOSITORY=1 + set +e + trap - EXIT + return 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 && |
