GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitPython/init-tests-after-clone.sh at 3.1.59 · gitpython-developers/GitPython

Expand file tree

/

init-tests-after-clone.sh

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
executable file
·
76 lines (62 loc) · 2.34 KB
/

init-tests-after-clone.sh

Copy path

File metadata and controls

executable file
·
76 lines (62 loc) · 2.34 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/sh
#
# This file is part of GitPython and is released under the
# 3-Clause BSD License: https://opensource.org/license/bsd-3-clause/
set -eu
fallback_repo_for_tags='https://github.com/gitpython-developers/GitPython.git'
ci() {
# For now, check just these, as a false positive could lead to data loss.
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 # Annotate workflow.
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
# Stop if we have run this. (You can delete __testing_point__ to let it rerun.)
# This also keeps track of where we are, so we can get back here.
git tag __testing_point__
# The tests need a branch called master.
#
# If master is locally absent but more than one remote has it, checkout fails
# by default even if all remotes agree, and we fall back to creating it at
# HEAD. The reflog we populate below then traces HEAD's history rather than
# a remote master's, but master is reset to __testing_point__ either way.
git checkout master -- || git checkout -b master
# The tests need a reflog history on the master branch.
git reset --hard HEAD~1
git reset --hard HEAD~1
git reset --hard HEAD~1
# Point the master branch where we started, so we test the correct code.
git reset --hard __testing_point__
# The tests need some version tags. Try to get them even in forks. This fetches
# other objects too. So, locally, we always do it, for a consistent experience.
if ! ci || no_version_tags; then
git fetch --all --tags
fi
# If we still have no version tags, try to get them from the original repo.
if no_version_tags; then
warn 'No local or remote version tags found. Trying fallback remote:' \
"$fallback_repo_for_tags"
# git fetch supports * but not [], and --no-tags means no *other* tags, so...
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
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.