MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / test_lock_file_in_worktree

Function test_lock_file_in_worktree

src/git_sync.rs:235–265  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 4

init_with_commitMethod · 0.80
pathMethod · 0.80
run_git_commandMethod · 0.80
with_repo_lockMethod · 0.80

Tested by

no test coverage detected