()
| 2740 | /// Test using --chain flag with a repository that has many chains |
| 2741 | #[test] |
| 2742 | fn merge_subcommand_with_many_chains() { |
| 2743 | let repo_name = "merge_with_many_chains"; |
| 2744 | let repo = setup_git_repo(repo_name); |
| 2745 | let path_to_repo = generate_path_to_repo(repo_name); |
| 2746 | |
| 2747 | println!("=== TEST SETUP: Initial Repository ==="); |
| 2748 | // Create initial repository state |
| 2749 | { |
| 2750 | create_new_file(&path_to_repo, "hello_world.txt", "Hello, world!"); |
| 2751 | first_commit_all(&repo, "first commit"); |
| 2752 | println!("Created master branch with hello_world.txt"); |
| 2753 | }; |
| 2754 | |
| 2755 | println!("=== CREATING MULTIPLE CHAINS ==="); |
| 2756 | // Create multiple chains (5 chains with 2 branches each) |
| 2757 | for i in 1..=5 { |
| 2758 | let chain_name = format!("chain_{}", i); |
| 2759 | let first_branch = format!("branch_{}_1", i); |
| 2760 | let second_branch = format!("branch_{}_2", i); |
| 2761 | |
| 2762 | println!( |
| 2763 | "Creating chain: {} with branches {} and {}", |
| 2764 | chain_name, first_branch, second_branch |
| 2765 | ); |
| 2766 | |
| 2767 | // Create first branch in chain |
| 2768 | checkout_branch(&repo, "master"); |
| 2769 | create_branch(&repo, &first_branch); |
| 2770 | checkout_branch(&repo, &first_branch); |
| 2771 | create_new_file( |
| 2772 | &path_to_repo, |
| 2773 | &format!("file_{}_1.txt", i), |
| 2774 | &format!("Content {}-1", i), |
| 2775 | ); |
| 2776 | commit_all(&repo, &format!("Commit {}-1", i)); |
| 2777 | println!("Created {} with file_{}_1.txt", first_branch, i); |
| 2778 | |
| 2779 | // Create second branch in chain |
| 2780 | create_branch(&repo, &second_branch); |
| 2781 | checkout_branch(&repo, &second_branch); |
| 2782 | create_new_file( |
| 2783 | &path_to_repo, |
| 2784 | &format!("file_{}_2.txt", i), |
| 2785 | &format!("Content {}-2", i), |
| 2786 | ); |
| 2787 | commit_all(&repo, &format!("Commit {}-2", i)); |
| 2788 | println!("Created {} with file_{}_2.txt", second_branch, i); |
| 2789 | |
| 2790 | // Setup the chain |
| 2791 | let args: Vec<&str> = vec![ |
| 2792 | "setup", |
| 2793 | &chain_name, |
| 2794 | "master", |
| 2795 | &first_branch, |
| 2796 | &second_branch, |
| 2797 | ]; |
| 2798 | let output = run_test_bin_expect_ok(&path_to_repo, args); |
| 2799 | let setup_stdout = String::from_utf8_lossy(&output.stdout); |
nothing calls this directly
no test coverage detected