summaryrefslogtreecommitdiffstats
path: root/tests/test_wrapper.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_wrapper.py')
-rw-r--r--tests/test_wrapper.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/tests/test_wrapper.py b/tests/test_wrapper.py
index 77ceda8f7..a38705675 100644
--- a/tests/test_wrapper.py
+++ b/tests/test_wrapper.py
@@ -23,7 +23,8 @@ import tempfile
23import unittest 23import unittest
24from unittest import mock 24from unittest import mock
25 25
26import git_command 26import utils_for_test
27
27import main 28import main
28import wrapper 29import wrapper
29 30
@@ -408,18 +409,7 @@ class GitCheckoutTestCase(RepoWrapperTestCase):
408 remote = os.path.join(cls.GIT_DIR, "remote") 409 remote = os.path.join(cls.GIT_DIR, "remote")
409 os.mkdir(remote) 410 os.mkdir(remote)
410 411
411 # Tests need to assume, that main is default branch at init, 412 utils_for_test.init_git_tree(remote)
412 # which is not supported in config until 2.28.
413 if git_command.git_require((2, 28, 0)):
414 initstr = "--initial-branch=main"
415 else:
416 # Use template dir for init.
417 templatedir = tempfile.mkdtemp(prefix=".test-template")
418 with open(os.path.join(templatedir, "HEAD"), "w") as fp:
419 fp.write("ref: refs/heads/main\n")
420 initstr = "--template=" + templatedir
421
422 run_git("init", initstr, cwd=remote)
423 run_git("commit", "--allow-empty", "-minit", cwd=remote) 413 run_git("commit", "--allow-empty", "-minit", cwd=remote)
424 run_git("branch", "stable", cwd=remote) 414 run_git("branch", "stable", cwd=remote)
425 run_git("tag", "v1.0", cwd=remote) 415 run_git("tag", "v1.0", cwd=remote)