Skip to content

Commit b18b523

Browse files
committed
fix current worktree detection
1 parent c345343 commit b18b523

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

asyncgit/src/sync/worktree.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ pub fn worktrees(repo_path: &RepoPath) -> Result<Vec<WorkTree>> {
5252
WorktreeLockStatus::Locked(_) => true,
5353
},
5454
is_prunable: wt.is_prunable(None)?,
55-
is_current: wt.path() == repo_path.gitpath(),
55+
is_current: wt.path().canonicalize()?
56+
== repo_path.gitpath().canonicalize()?,
5657
})
5758
})
5859
.filter_map(|s: Result<WorkTree>| {
@@ -89,6 +90,7 @@ pub fn create_worktree(
8990
let repo_obj = repo(repo_path)?;
9091
let path_str = repo_path.gitpath().to_str().unwrap();
9192

93+
// WARNING:
9294
// if we are in a worktree assume we want to create a worktree in the parent directory
9395
// This is not always accurate but it should work in most cases
9496
let real_path = match repo_obj.is_worktree() {

0 commit comments

Comments
 (0)