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

Function merge_subcommand_squashed_merge_options

tests/merge.rs:3493–3879  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3491/// Test merge feature: squashed_merge handling options
3492#[test]
3493fn merge_subcommand_squashed_merge_options() {
3494 use std::path::Path;
3495
3496 // Helper function to get formatted git log output
3497 fn get_git_log(path_to_repo: &Path, num_entries: &str) -> String {
3498 let output = run_git_command(path_to_repo, vec!["log", "--oneline", "-n", num_entries]);
3499 String::from_utf8_lossy(&output.stdout).to_string()
3500 }
3501
3502 println!("=== MERGE SUBCOMMAND WITH SQUASHED MERGE OPTIONS ===");
3503 let repo_name = "merge_squashed_merge_options";
3504 let repo = setup_git_repo(repo_name);
3505 let path_to_repo = generate_path_to_repo(repo_name);
3506
3507 println!("=== SETUP: INITIAL REPOSITORY WITH CHAIN ===");
3508 {
3509 create_new_file(&path_to_repo, "hello_world.txt", "Hello, world!");
3510 first_commit_all(&repo, "first commit");
3511
3512 // Create branches for chain
3513 create_branch(&repo, "feature_1");
3514 checkout_branch(&repo, "feature_1");
3515 create_new_file(&path_to_repo, "feature1.txt", "Feature 1 content");
3516 commit_all(&repo, "feature 1 commit");
3517
3518 create_branch(&repo, "feature_2");
3519 checkout_branch(&repo, "feature_2");
3520 create_new_file(&path_to_repo, "feature2.txt", "Feature 2 content");
3521 commit_all(&repo, "feature 2 commit");
3522
3523 // Setup the chain
3524 let args: Vec<&str> = vec!["setup", "feature_chain", "master", "feature_1", "feature_2"];
3525 let output = run_test_bin(&path_to_repo, args);
3526
3527 let stdout = String::from_utf8_lossy(&output.stdout);
3528 let stderr = String::from_utf8_lossy(&output.stderr);
3529 let success = output.status.success();
3530 let status_code = output.status.code().unwrap_or(0);
3531
3532 println!("Chain setup stdout: {}", stdout);
3533 println!("Chain setup stderr: {}", stderr);
3534 println!("Chain setup success: {}", success);
3535 println!("Chain setup status code: {}", status_code);
3536
3537 let contains_setup_success = stdout.contains("Succesfully set up chain: feature_chain");
3538 println!("Contains setup success message: {}", contains_setup_success);
3539
3540 assert!(
3541 success,
3542 "Chain setup command should succeed but failed with status code: {}",
3543 status_code
3544 );
3545 assert!(
3546 contains_setup_success,
3547 "stdout should confirm chain setup but got: {}",
3548 stdout
3549 );
3550 assert!(

Callers

nothing calls this directly

Calls 12

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_binFunction · 0.85
get_current_branch_nameFunction · 0.85
run_git_commandFunction · 0.85
get_git_logFunction · 0.85
teardown_git_repoFunction · 0.85

Tested by

no test coverage detected