Skip to content

Commit 1fb5875

Browse files
committed
fix(tests): Update remaining master branch references to main
why: Complete the migration from master to main as default branch what: - Update test_get_current_remote_name to checkout 'main' instead of 'master' - Update Git.rebase doctests to expect 'main' in output - Update Git.rev_list doctest to expect 'main' in commit output - All tests now pass with the new default branch configuration
1 parent 367f559 commit 1fb5875

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
def add_doctest_fixtures(
2525
request: pytest.FixtureRequest,
2626
doctest_namespace: dict[str, t.Any],
27+
monkeypatch: pytest.MonkeyPatch,
2728
) -> None:
2829
"""Configure doctest fixtures for pytest-doctest."""
2930
from _pytest.doctest import DoctestItem

src/libvcs/cmd/git.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -655,14 +655,14 @@ def rebase(
655655
>>> git = Git(path=example_git_repo.path)
656656
>>> git_remote_repo = create_git_remote_repo()
657657
>>> git.rebase()
658-
'Current branch master is up to date.'
658+
'Current branch main is up to date.'
659659
660660
Declare upstream:
661661
662662
>>> git = Git(path=example_git_repo.path)
663663
>>> git_remote_repo = create_git_remote_repo()
664664
>>> git.rebase(upstream='origin')
665-
'Current branch master is up to date.'
665+
'Current branch main is up to date.'
666666
>>> git.path.exists()
667667
True
668668
"""
@@ -1399,9 +1399,9 @@ def checkout(
13991399
>>> git = Git(path=example_git_repo.path)
14001400
14011401
>>> git.checkout()
1402-
"Your branch is up to date with 'origin/master'."
1402+
"Your branch is up to date with 'origin/main'."
14031403
1404-
>>> git.checkout(branch='origin/master', pathspec='.')
1404+
>>> git.checkout(branch='origin/main', pathspec='.')
14051405
''
14061406
"""
14071407
local_flags: list[str] = []
@@ -1517,7 +1517,7 @@ def status(
15171517
>>> git = Git(path=example_git_repo.path)
15181518
15191519
>>> git.status()
1520-
"On branch master..."
1520+
"On branch main..."
15211521
15221522
>>> pathlib.Path(example_git_repo.path / 'new_file.txt').touch()
15231523
@@ -2057,7 +2057,7 @@ def rev_list(
20572057
'...'
20582058
20592059
>>> git.run(['commit', '--allow-empty', '--message=Moo'])
2060-
'[master ...] Moo'
2060+
'[main ...] Moo'
20612061
20622062
>>> git.rev_list(commit="HEAD", max_count=1)
20632063
'...'
@@ -2243,17 +2243,17 @@ def show_ref(
22432243
>>> git.show_ref()
22442244
'...'
22452245
2246-
>>> git.show_ref(pattern='master')
2246+
>>> git.show_ref(pattern='main')
22472247
'...'
22482248
2249-
>>> git.show_ref(pattern='master', head=True)
2249+
>>> git.show_ref(pattern='main', head=True)
22502250
'...'
22512251
22522252
>>> git.show_ref(pattern='HEAD', verify=True)
22532253
'... HEAD'
22542254
2255-
>>> git.show_ref(pattern='master', dereference=True)
2256-
'... refs/heads/master\n... refs/remotes/origin/master'
2255+
>>> git.show_ref(pattern='main', dereference=True)
2256+
'... refs/heads/main\n... refs/remotes/origin/main'
22572257
22582258
>>> git.show_ref(pattern='HEAD', tags=True)
22592259
''

src/libvcs/sync/git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,8 @@ def status(self) -> GitStatus:
678678
>>> git_repo.obtain()
679679
>>> git_repo.status()
680680
GitStatus(\
681-
branch_oid='...', branch_head='master', \
682-
branch_upstream='origin/master', \
681+
branch_oid='...', branch_head='main', \
682+
branch_upstream='origin/main', \
683683
branch_ab='+0 -0', \
684684
branch_ahead='0', \
685685
branch_behind='0'\

tests/sync/test_git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -757,14 +757,14 @@ def test_get_current_remote_name(git_repo: GitSync) -> None:
757757
"Should reflect new upstream branch (different remote)"
758758
)
759759

760-
upstream = "{}/{}".format(new_remote_name, "master")
760+
upstream = "{}/{}".format(new_remote_name, "main")
761761

762762
git_repo.run(["branch", "--set-upstream-to", upstream])
763763
assert git_repo.get_current_remote_name() == upstream, (
764764
"Should reflect upstream branch (different remote+branch)"
765765
)
766766

767-
git_repo.run(["checkout", "master"])
767+
git_repo.run(["checkout", "main"])
768768

769769
# Different remote, different branch
770770
remote = f"{new_remote_name}/{new_branch}"

0 commit comments

Comments
 (0)