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

Function test_set_git_town_parent_idempotent

src/git.rs:1229–1257  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1227
1228 #[tokio::test]
1229 async fn test_set_git_town_parent_idempotent() {
1230 // Create a git repository with an initial commit
1231 let test_repo = TestGitRepository::new().unwrap();
1232 test_repo.init_with_commit().unwrap();
1233
1234 let branch_name = "tsk/feat/test-feature/abc123";
1235 test_repo.checkout_new_branch(branch_name).unwrap();
1236
1237 let ctx = AppContext::builder().build();
1238 let manager = RepoManager::new(&ctx);
1239
1240 // Set the parent twice - should not fail
1241 let result1 = manager
1242 .set_git_town_parent(test_repo.path(), branch_name, "main")
1243 .await;
1244 assert!(result1.is_ok());
1245
1246 let result2 = manager
1247 .set_git_town_parent(test_repo.path(), branch_name, "develop")
1248 .await;
1249 assert!(result2.is_ok());
1250
1251 // Verify the config was updated to the second value
1252 let repo = git2::Repository::open(test_repo.path()).unwrap();
1253 let config = repo.config().unwrap();
1254 let key = format!("git-town-branch.{}.parent", branch_name);
1255 let parent = config.get_string(&key).unwrap();
1256 assert_eq!(parent, "develop");
1257 }
1258
1259 #[tokio::test]
1260 async fn test_commit_changes_no_changes() {

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