|
#!/bin/sh |
|
|
|
set -eu |
|
|
|
fallback_repo_for_tags='https://github.com/gitpython-developers/GitPython.git' |
|
|
|
ci() { |
|
|
|
test -n "${TRAVIS-}" || test -n "${GITHUB_ACTIONS-}" |
|
} |
|
|
|
no_version_tags() { |
|
test -z "$(git tag -l '[0-9]*' 'v[0-9]*')" |
|
} |
|
|
|
warn() { |
|
if test -n "${GITHUB_ACTIONS-}"; then |
|
printf '::warning ::%s\n' "$*" >&2 |
|
else |
|
printf '%s\n' "$@" >&2 |
|
fi |
|
} |
|
|
|
if ! ci; then |
|
printf 'This operation will destroy locally modified files. Continue ? [N/y]: ' >&2 |
|
read -r answer |
|
case "$answer" in |
|
[yY]) |
|
;; |
|
*) |
|
exit 2 ;; |
|
esac |
|
fi |
|
|
|
|
|
|
|
git tag __testing_point__ |
|
|
|
|
|
git checkout master -- || git checkout -b master |
|
|
|
|
|
git reset --hard HEAD~1 |
|
git reset --hard HEAD~1 |
|
git reset --hard HEAD~1 |
|
|
|
|
|
git reset --hard __testing_point__ |
|
|
|
|
|
git submodule update --init --recursive |
|
|
|
|
|
|
|
if ! ci || no_version_tags; then |
|
git fetch --all --tags |
|
fi |
|
|
|
|
|
if no_version_tags; then |
|
warn 'No local or remote version tags found. Trying fallback remote:' \ |
|
"$fallback_repo_for_tags" |
|
|
|
|
|
printf 'refs/tags/%d*:refs/tags/%d*\n' 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 | |
|
xargs git fetch --no-tags "$fallback_repo_for_tags" |
|
|
|
if no_version_tags; then |
|
warn 'No version tags found anywhere. Some tests will fail.' |
|
fi |
|
fi |
|
|