()
| 12 | |
| 13 | #[test] |
| 14 | fn push_subcommand() { |
| 15 | let repo_name = "push_subcommand"; |
| 16 | let repo = setup_git_repo(repo_name); |
| 17 | let _bare_repo = setup_git_bare_repo(repo_name); |
| 18 | let path_to_repo = generate_path_to_repo(repo_name); |
| 19 | |
| 20 | let path_to_bare_repo = { |
| 21 | let mut path_to_bare_repo_buf: PathBuf = generate_path_to_bare_repo(repo_name); |
| 22 | if path_to_bare_repo_buf.is_relative() { |
| 23 | path_to_bare_repo_buf = path_to_bare_repo_buf.canonicalize().unwrap(); |
| 24 | } |
| 25 | |
| 26 | path_to_bare_repo_buf.to_str().unwrap().to_string() |
| 27 | }; |
| 28 | |
| 29 | run_git_command( |
| 30 | path_to_repo.clone(), |
| 31 | vec!["remote", "add", "origin", &path_to_bare_repo], |
| 32 | ); |
| 33 | |
| 34 | { |
| 35 | // create new file |
| 36 | create_new_file(&path_to_repo, "hello_world.txt", "Hello, world!"); |
| 37 | |
| 38 | // add first commit to master |
| 39 | first_commit_all(&repo, "first commit"); |
| 40 | }; |
| 41 | |
| 42 | assert_eq!(&get_current_branch_name(&repo), "master"); |
| 43 | |
| 44 | // create and checkout new branch named some_branch_1 |
| 45 | { |
| 46 | let branch_name = "some_branch_1"; |
| 47 | create_branch(&repo, branch_name); |
| 48 | checkout_branch(&repo, branch_name); |
| 49 | }; |
| 50 | |
| 51 | { |
| 52 | assert_eq!(&get_current_branch_name(&repo), "some_branch_1"); |
| 53 | |
| 54 | create_new_file(&path_to_repo, "file_1.txt", "contents 1"); |
| 55 | commit_all(&repo, "message"); |
| 56 | }; |
| 57 | |
| 58 | // create and checkout new branch named some_branch_2 |
| 59 | { |
| 60 | let branch_name = "some_branch_2"; |
| 61 | create_branch(&repo, branch_name); |
| 62 | checkout_branch(&repo, branch_name); |
| 63 | }; |
| 64 | |
| 65 | { |
| 66 | assert_eq!(&get_current_branch_name(&repo), "some_branch_2"); |
| 67 | |
| 68 | // create new file |
| 69 | create_new_file(&path_to_repo, "file_2.txt", "contents 2"); |
| 70 | |
| 71 | // add commit to branch some_branch_2 |
nothing calls this directly
no test coverage detected