()
| 233 | |
| 234 | #[tokio::test] |
| 235 | async fn test_lock_file_in_worktree() { |
| 236 | let sync_manager = GitSyncManager::new(); |
| 237 | let repo = TestGitRepository::new().unwrap(); |
| 238 | repo.init_with_commit().unwrap(); |
| 239 | |
| 240 | let worktree_dir = repo.path().parent().unwrap().join("sync-worktree-test"); |
| 241 | repo.run_git_command(&[ |
| 242 | "worktree", |
| 243 | "add", |
| 244 | worktree_dir.to_str().unwrap(), |
| 245 | "-b", |
| 246 | "wt-sync", |
| 247 | ]) |
| 248 | .unwrap(); |
| 249 | |
| 250 | // This should NOT panic |
| 251 | sync_manager |
| 252 | .with_repo_lock(&worktree_dir, || async {}) |
| 253 | .await; |
| 254 | |
| 255 | // Lock file should be in the MAIN repo's .git, not the worktree |
| 256 | let main_lock = repo.path().join(".git").join("tsk.lock"); |
| 257 | assert!( |
| 258 | main_lock.exists(), |
| 259 | "Lock file should be in main repo's .git dir" |
| 260 | ); |
| 261 | |
| 262 | // Clean up |
| 263 | std::fs::remove_dir_all(&worktree_dir).ok(); |
| 264 | repo.run_git_command(&["worktree", "prune"]).ok(); |
| 265 | } |
| 266 | } |
nothing calls this directly
no test coverage detected