Skip to content

Commit 90e2b33

Browse files
committed
Fix tests for temporary worktrees on NixOS
1 parent 8e8666b commit 90e2b33

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

git_machete/client/traverse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def _switch_branch(
113113
config_value = self._config.traverse_when_branch_not_checked_out_in_any_worktree()
114114

115115
if config_value == TraverseWhenBranchNotCheckedOutInAnyWorktree.CD_INTO_TEMPORARY_WORKTREE:
116-
temp_worktree_path = tempfile.mkdtemp(prefix="git-machete-")
116+
temp_worktree_path = tempfile.mkdtemp(prefix="git-machete-worktree-")
117117
print_no_newline(f"Creating a temporary worktree to check out {bold(target_branch)}... ")
118118
self._git.worktree_add(temp_worktree_path, target_branch)
119119
print(green_ok())

tests/test_traverse_worktrees.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ def test_traverse_cd_into_temporary_worktree_when_branch_not_checked_out(self, m
605605

606606
# Verify no temporary worktree lingers after traverse
607607
assert len(get_worktree_dirs()) == 2
608-
assert "git-machete-" not in " ".join(get_worktree_dirs())
608+
assert "git-machete-worktree-" not in " ".join(get_worktree_dirs())
609609

610610
def test_traverse_cd_into_temporary_worktree_with_rebase(self) -> None:
611611
"""Test that traverse with temporary worktrees correctly performs rebase operations."""
@@ -658,7 +658,7 @@ def test_traverse_cd_into_temporary_worktree_with_rebase(self) -> None:
658658

659659
# Verify no temporary worktree lingers after traverse
660660
assert len(get_worktree_dirs()) == 1
661-
assert "git-machete-" not in " ".join(get_worktree_dirs())
661+
assert "git-machete-worktree-" not in " ".join(get_worktree_dirs())
662662

663663
def test_traverse_cd_into_temporary_worktree_warns_when_started_from_linked_worktree(self) -> None:
664664
"""Test that the end-of-traverse warning fires when temp worktree cleanup lands us in main worktree,
@@ -729,7 +729,7 @@ def test_traverse_cd_into_temporary_worktree_warns_when_started_from_linked_work
729729

730730
# Verify no temporary worktree lingers after traverse
731731
assert len(get_worktree_dirs()) == 2
732-
assert "git-machete-" not in " ".join(get_worktree_dirs())
732+
assert "git-machete-worktree-" not in " ".join(get_worktree_dirs())
733733

734734
# The expected error message includes `--empty=drop` which is only passed on git >= 2.26.0.
735735
@pytest.mark.skipif(get_git_version() < (2, 26, 0), reason="--empty=drop is only passed to git rebase since git 2.26.0")

0 commit comments

Comments
 (0)