MCPcopy Create free account
hub / github.com/dashed/git-chain / merge_subcommand_fork_point_options

Function merge_subcommand_fork_point_options

tests/merge.rs:4338–4535  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4336/// Test the --no-fork-point vs. --fork-point options
4337#[test]
4338fn merge_subcommand_fork_point_options() {
4339 println!("=== TEST SETUP: MERGE SUBCOMMAND FORK POINT OPTIONS ===");
4340 let repo_name = "merge_fork_point_options";
4341 let repo = setup_git_repo(repo_name);
4342 let path_to_repo = generate_path_to_repo(repo_name);
4343
4344 // Helper function to get git log for a specific branch
4345 fn get_git_log(path_to_repo: &Path, branch_name: &str, num_entries: &str) -> String {
4346 let output = run_git_command(
4347 path_to_repo,
4348 vec!["log", "--oneline", "-n", num_entries, branch_name],
4349 );
4350 String::from_utf8_lossy(&output.stdout).to_string()
4351 }
4352
4353 println!("=== REPOSITORY INITIALIZATION ===");
4354 // Create initial repository
4355 {
4356 create_new_file(&path_to_repo, "hello_world.txt", "Hello, world!");
4357 first_commit_all(&repo, "first commit");
4358
4359 // Create branches for chain
4360 create_branch(&repo, "feature_1");
4361 checkout_branch(&repo, "feature_1");
4362 create_new_file(&path_to_repo, "feature1.txt", "Feature 1 content");
4363 commit_all(&repo, "feature 1 commit");
4364
4365 create_branch(&repo, "feature_2");
4366 checkout_branch(&repo, "feature_2");
4367 create_new_file(&path_to_repo, "feature2.txt", "Feature 2 content");
4368 commit_all(&repo, "feature 2 commit");
4369
4370 println!("=== SETTING UP CHAIN ===");
4371 // Setup the chain
4372 let args: Vec<&str> = vec!["setup", "feature_chain", "master", "feature_1", "feature_2"];
4373 let output = run_test_bin_expect_ok(&path_to_repo, args);
4374
4375 let stdout = String::from_utf8_lossy(&output.stdout);
4376 let success_setup = stdout.contains("Succesfully set up chain: feature_chain");
4377
4378 println!("Chain setup output: {}", stdout);
4379 println!("Chain setup success: {}", success_setup);
4380
4381 assert!(
4382 success_setup,
4383 "stdout should confirm chain setup but got: {}",
4384 stdout
4385 );
4386 }
4387
4388 println!("=== MASTER BRANCH FIRST UPDATE ===");
4389 // Update master
4390 checkout_branch(&repo, "master");
4391 create_new_file(&path_to_repo, "master_update.txt", "Master update");
4392 commit_all(&repo, "Update master");
4393
4394 // Verify master has the update
4395 let master_log = get_git_log(&path_to_repo, "master", "5");

Callers

nothing calls this directly

Calls 11

setup_git_repoFunction · 0.85
generate_path_to_repoFunction · 0.85
create_new_fileFunction · 0.85
first_commit_allFunction · 0.85
create_branchFunction · 0.85
checkout_branchFunction · 0.85
commit_allFunction · 0.85
run_test_bin_expect_okFunction · 0.85
get_git_logFunction · 0.85
get_current_branch_nameFunction · 0.85
teardown_git_repoFunction · 0.85

Tested by

no test coverage detected