Skip to content

Commit 219c5ed

Browse files
committed
Fix coverage
1 parent 6e594fd commit 219c5ed

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

git_machete/client/traverse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def _update_worktrees_cache_after_checkout(self, checked_out_branch: LocalBranch
6161
# Remove the old branch entry for this worktree (if any)
6262
# We need to find which branch was previously checked out in this worktree
6363
for branch, path in self.__worktrees_cache.items():
64-
if path == current_worktree_path:
64+
if path == current_worktree_path: # pragma: no branch
6565
del self.__worktrees_cache[branch]
66-
break # pragma: no branch
66+
break
6767

6868
# Add the new branch entry for this worktree
6969
self.__worktrees_cache[checked_out_branch] = current_worktree_path

git_machete/git_operations.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,8 @@ def get_worktrees(self) -> Dict[LocalBranchShortName, str]:
598598
elif line.startswith('branch '):
599599
# Format: "branch refs/heads/<branch-name>"
600600
branch_ref = line[len('branch '):]
601-
if branch_ref.startswith('refs/heads/'):
602-
current_branch = LocalBranchShortName.of(branch_ref[len('refs/heads/'):])
603-
is_detached = False
601+
current_branch = LocalBranchFullName.of(branch_ref).to_short_name()
602+
is_detached = False
604603
elif line.startswith('detached'):
605604
is_detached = True
606605
current_branch = None
@@ -644,7 +643,7 @@ def get_main_worktree_path(self) -> str:
644643
return line[len('worktree '):]
645644

646645
# Fallback: if no worktrees found, return current root dir
647-
return self.get_root_dir()
646+
return self.get_root_dir() # pragma: no cover
648647

649648
def checkout(self, branch: LocalBranchShortName) -> None:
650649
self._run_git("checkout", "--quiet", branch, "--", flush_caches=True)

0 commit comments

Comments
 (0)