Skip to content

Commit cbbf193

Browse files
committed
Fix coverage
1 parent 8e93257 commit cbbf193

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

git_machete/client/traverse.py

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

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

git_machete/git_operations.py

Lines changed: 4 additions & 5 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
@@ -640,11 +639,11 @@ def get_main_worktree_path(self) -> str:
640639

641640
# The first worktree in the list is always the main worktree
642641
for line in result.stdout.strip().splitlines():
643-
if line.startswith('worktree '):
642+
if line.startswith('worktree '): # pragma: no branch
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)