Merge pull request #4659 from reitermarkus/unshallow

Always fetch at least the latest tag.
This commit is contained in:
Markus Reiter 2018-08-11 17:42:38 +02:00 committed by GitHub
commit f2163d0f6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 3 deletions

View File

@ -59,7 +59,7 @@ HOMEBREW_VERSION="$(git -C "$HOMEBREW_REPOSITORY" describe --tags --dirty --abbr
HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION" HOMEBREW_USER_AGENT_VERSION="$HOMEBREW_VERSION"
if [[ -z "$HOMEBREW_VERSION" ]] if [[ -z "$HOMEBREW_VERSION" ]]
then then
HOMEBREW_VERSION=">=1.4.0 (shallow or no git repository)" HOMEBREW_VERSION=">=1.7.1 (shallow or no git repository)"
HOMEBREW_USER_AGENT_VERSION="1.X.Y" HOMEBREW_USER_AGENT_VERSION="1.X.Y"
fi fi

View File

@ -33,7 +33,14 @@ EOS
[[ -d "$DIR/.git" ]] || continue [[ -d "$DIR/.git" ]] || continue
cd "$DIR" || continue cd "$DIR" || continue
echo "==> Fetching $DIR..." echo "==> Fetching $DIR..."
git fetch --tags --force origin
if [[ "$DIR" = "$HOMEBREW_REPOSITORY" ]]; then
latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
git fetch --force origin --shallow-since="$latest_tag"
else
git fetch --force --tags origin
fi
echo echo
echo "==> Resetting $DIR..." echo "==> Resetting $DIR..."

View File

@ -35,7 +35,8 @@ git_init_if_necessary() {
git config --bool core.autocrlf false git config --bool core.autocrlf false
git config remote.origin.url "$BREW_OFFICIAL_REMOTE" git config remote.origin.url "$BREW_OFFICIAL_REMOTE"
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*" git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch --force --depth=1 origin refs/heads/master:refs/remotes/origin/master latest_tag="$(git ls-remote --tags --refs -q origin | tail -n1 | cut -f2)"
git fetch --force origin --shallow-since="$latest_tag"
git reset --hard origin/master git reset --hard origin/master
SKIP_FETCH_BREW_REPOSITORY=1 SKIP_FETCH_BREW_REPOSITORY=1
set +e set +e