()
| 5073 | /// Test combining multiple merge flags |
| 5074 | #[test] |
| 5075 | fn merge_subcommand_combined_flags() { |
| 5076 | println!("=== TEST SETUP: MERGE SUBCOMMAND COMBINED FLAGS ==="); |
| 5077 | let repo_name = "merge_combined_flags"; |
| 5078 | let repo = setup_git_repo(repo_name); |
| 5079 | let path_to_repo = generate_path_to_repo(repo_name); |
| 5080 | |
| 5081 | // Helper function to get git log |
| 5082 | let get_git_log = |branch_name: &str, num_entries: &str| -> String { |
| 5083 | let output = run_git_command( |
| 5084 | &path_to_repo, |
| 5085 | vec!["log", "--oneline", "-n", num_entries, branch_name], |
| 5086 | ); |
| 5087 | String::from_utf8_lossy(&output.stdout).to_string() |
| 5088 | }; |
| 5089 | |
| 5090 | // Helper function to check if file exists |
| 5091 | let file_exists = |filename: &str| -> bool { |
| 5092 | std::path::Path::new(&format!("{}/{}", path_to_repo.to_string_lossy(), filename)).exists() |
| 5093 | }; |
| 5094 | |
| 5095 | println!("=== REPOSITORY AND CHAIN INITIALIZATION ==="); |
| 5096 | // Create initial repository with two chains |
| 5097 | { |
| 5098 | create_new_file(&path_to_repo, "hello_world.txt", "Hello, world!"); |
| 5099 | first_commit_all(&repo, "first commit"); |
| 5100 | |
| 5101 | // Create first chain |
| 5102 | println!("Creating first chain (feature_chain)..."); |
| 5103 | create_branch(&repo, "feature_1"); |
| 5104 | checkout_branch(&repo, "feature_1"); |
| 5105 | create_new_file(&path_to_repo, "feature1.txt", "Feature 1 content"); |
| 5106 | commit_all(&repo, "feature 1 commit"); |
| 5107 | |
| 5108 | println!("Creating feature_2 branch..."); |
| 5109 | create_branch(&repo, "feature_2"); |
| 5110 | checkout_branch(&repo, "feature_2"); |
| 5111 | create_new_file(&path_to_repo, "feature2.txt", "Feature 2 content"); |
| 5112 | commit_all(&repo, "feature 2 commit"); |
| 5113 | |
| 5114 | // Setup first chain |
| 5115 | println!("Setting up feature_chain: master -> feature_1 -> feature_2"); |
| 5116 | let args: Vec<&str> = vec!["setup", "feature_chain", "master", "feature_1", "feature_2"]; |
| 5117 | let output = run_test_bin_expect_ok(&path_to_repo, args); |
| 5118 | |
| 5119 | let stdout = String::from_utf8_lossy(&output.stdout); |
| 5120 | let feature_chain_setup_success = |
| 5121 | stdout.contains("Succesfully set up chain: feature_chain"); |
| 5122 | |
| 5123 | println!("Feature chain setup output: {}", stdout); |
| 5124 | println!( |
| 5125 | "Feature chain setup success: {}", |
| 5126 | feature_chain_setup_success |
| 5127 | ); |
| 5128 | |
| 5129 | assert!( |
| 5130 | feature_chain_setup_success, |
| 5131 | "Expected successful feature_chain setup but got: {}", |
| 5132 | stdout |
nothing calls this directly
no test coverage detected