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>
This commit is contained in:
parent
e8caa48cc2
commit
0f6def90b7
@ -42,22 +42,21 @@ 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
|
||||
fi
|
||||
|
||||
set +e
|
||||
trap - EXIT
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$(git remote show origin -n)" = *"mxcl/homebrew"* ]]
|
||||
then
|
||||
|
Loading…
x
Reference in New Issue
Block a user