diff options
Diffstat (limited to 'tests/test_wrapper.py')
| -rw-r--r-- | tests/test_wrapper.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py index d22dc4ee..069a5c3b 100644 --- a/tests/test_wrapper.py +++ b/tests/test_wrapper.py | |||
| @@ -25,6 +25,7 @@ import shutil | |||
| 25 | import tempfile | 25 | import tempfile |
| 26 | import unittest | 26 | import unittest |
| 27 | 27 | ||
| 28 | import git_command | ||
| 28 | import platform_utils | 29 | import platform_utils |
| 29 | from pyversion import is_python3 | 30 | from pyversion import is_python3 |
| 30 | import wrapper | 31 | import wrapper |
| @@ -357,7 +358,19 @@ class GitCheckoutTestCase(RepoWrapperTestCase): | |||
| 357 | 358 | ||
| 358 | remote = os.path.join(cls.GIT_DIR, 'remote') | 359 | remote = os.path.join(cls.GIT_DIR, 'remote') |
| 359 | os.mkdir(remote) | 360 | os.mkdir(remote) |
| 360 | run_git('init', cwd=remote) | 361 | |
| 362 | # Tests need to assume, that main is default branch at init, | ||
| 363 | # which is not supported in config until 2.28. | ||
| 364 | if git_command.git_require((2, 28, 0)): | ||
| 365 | initstr = '--initial-branch=main' | ||
| 366 | else: | ||
| 367 | # Use template dir for init. | ||
| 368 | templatedir = tempfile.mkdtemp(prefix='.test-template') | ||
| 369 | with open(os.path.join(templatedir, 'HEAD'), 'w') as fp: | ||
| 370 | fp.write('ref: refs/heads/main\n') | ||
| 371 | initstr = '--template=' + templatedir | ||
| 372 | |||
| 373 | run_git('init', initstr, cwd=remote) | ||
| 361 | run_git('commit', '--allow-empty', '-minit', cwd=remote) | 374 | run_git('commit', '--allow-empty', '-minit', cwd=remote) |
| 362 | run_git('branch', 'stable', cwd=remote) | 375 | run_git('branch', 'stable', cwd=remote) |
| 363 | run_git('tag', 'v1.0', cwd=remote) | 376 | run_git('tag', 'v1.0', cwd=remote) |
