Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
GitPython/init-tests-after-clone.sh at v4-breaking · gitpython-developers/GitPython · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
gitpython-developers
/
GitPython
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
998
Star
5.2k
Code
Issues
7
Pull requests
2
Discussions
Actions
Security and quality
35
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Security and quality
Insights
Files
Expand file tree
v4-breaking
Breadcrumbs
GitPython
/
init-tests-after-clone.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
76 lines (62 loc) · 2.34 KB
v4-breaking
Breadcrumbs
GitPython
/
init-tests-after-clone.sh
Copy path
Top
File metadata and controls
Code
Blame
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 can’t perform that action at this time.