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

Function test_set_git_town_parent

src/git.rs:1201–1226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1199
1200 #[tokio::test]
1201 async fn test_set_git_town_parent() {
1202 // Create a git repository with an initial commit
1203 let test_repo = TestGitRepository::new().unwrap();
1204 test_repo.init_with_commit().unwrap();
1205
1206 // Create a branch to set the parent for
1207 let branch_name = "tsk/feat/test-feature/abc123";
1208 test_repo.checkout_new_branch(branch_name).unwrap();
1209
1210 let ctx = AppContext::builder().build();
1211 let manager = RepoManager::new(&ctx);
1212
1213 // Set the git-town parent
1214 let result = manager
1215 .set_git_town_parent(test_repo.path(), branch_name, "main")
1216 .await;
1217
1218 assert!(result.is_ok(), "Error: {result:?}");
1219
1220 // Verify the config was set correctly
1221 let repo = git2::Repository::open(test_repo.path()).unwrap();
1222 let config = repo.config().unwrap();
1223 let key = format!("git-town-branch.{}.parent", branch_name);
1224 let parent = config.get_string(&key).unwrap();
1225 assert_eq!(parent, "main");
1226 }
1227
1228 #[tokio::test]
1229 async fn test_set_git_town_parent_idempotent() {

Callers

nothing calls this directly

Calls 5

init_with_commitMethod · 0.80
checkout_new_branchMethod · 0.80
set_git_town_parentMethod · 0.80
pathMethod · 0.80
buildMethod · 0.45

Tested by

no test coverage detected