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

Function test_copy_repo_without_source_commit

src/git.rs:1544–1581  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1542
1543 #[tokio::test]
1544 async fn test_copy_repo_without_source_commit() {
1545 let ctx = AppContext::builder().build();
1546
1547 // Create a repository with commits
1548 let test_repo = TestGitRepository::new().unwrap();
1549 test_repo.init_with_commit().unwrap();
1550
1551 // Add more files
1552 test_repo
1553 .create_file("feature.rs", "fn feature() {}")
1554 .unwrap();
1555 test_repo.stage_all().unwrap();
1556 test_repo.commit("Add feature").unwrap();
1557
1558 let manager = RepoManager::new(&ctx);
1559
1560 // Copy repo without specifying source commit (should use HEAD)
1561 let task_id = "ijkl9012";
1562 let branch_name = "tsk/test/copy-repo-head/ijkl9012";
1563 let result = manager
1564 .copy_repo(
1565 task_id,
1566 test_repo.path(),
1567 None,
1568 branch_name,
1569 CopyMode::WorkingTree,
1570 )
1571 .await;
1572
1573 assert!(result.is_ok());
1574 let copied_path = result.unwrap().repo_path;
1575
1576 assert!(copied_path.exists());
1577
1578 // Verify the copied repo has all files from HEAD
1579 assert!(copied_path.join("README.md").exists());
1580 assert!(copied_path.join("feature.rs").exists());
1581 }
1582
1583 #[tokio::test]
1584 async fn test_copy_repo_separates_tracked_and_untracked_files() {

Callers

nothing calls this directly

Calls 7

init_with_commitMethod · 0.80
create_fileMethod · 0.80
stage_allMethod · 0.80
commitMethod · 0.80
copy_repoMethod · 0.80
pathMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected