()
| 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() { |
nothing calls this directly
no test coverage detected