()
| 134 | |
| 135 | #[test] |
| 136 | fn push_subcommand_force() { |
| 137 | let repo_name = "push_subcommand_force"; |
| 138 | let repo = setup_git_repo(repo_name); |
| 139 | let _bare_repo = setup_git_bare_repo(repo_name); |
| 140 | let path_to_repo = generate_path_to_repo(repo_name); |
| 141 | |
| 142 | let path_to_bare_repo = { |
| 143 | let mut path_to_bare_repo_buf: PathBuf = generate_path_to_bare_repo(repo_name); |
| 144 | if path_to_bare_repo_buf.is_relative() { |
| 145 | path_to_bare_repo_buf = path_to_bare_repo_buf.canonicalize().unwrap(); |
| 146 | } |
| 147 | |
| 148 | path_to_bare_repo_buf.to_str().unwrap().to_string() |
| 149 | }; |
| 150 | |
| 151 | run_git_command( |
| 152 | path_to_repo.clone(), |
| 153 | vec!["remote", "add", "origin", &path_to_bare_repo], |
| 154 | ); |
| 155 | |
| 156 | { |
| 157 | // create new file |
| 158 | create_new_file(&path_to_repo, "hello_world.txt", "Hello, world!"); |
| 159 | |
| 160 | // add first commit to master |
| 161 | first_commit_all(&repo, "first commit"); |
| 162 | }; |
| 163 | |
| 164 | assert_eq!(&get_current_branch_name(&repo), "master"); |
| 165 | |
| 166 | // create and checkout new branch named some_branch_1 |
| 167 | { |
| 168 | let branch_name = "some_branch_1"; |
| 169 | create_branch(&repo, branch_name); |
| 170 | checkout_branch(&repo, branch_name); |
| 171 | }; |
| 172 | |
| 173 | { |
| 174 | assert_eq!(&get_current_branch_name(&repo), "some_branch_1"); |
| 175 | |
| 176 | create_new_file(&path_to_repo, "file_1.txt", "contents 1"); |
| 177 | commit_all(&repo, "message"); |
| 178 | }; |
| 179 | |
| 180 | // create and checkout new branch named some_branch_2 |
| 181 | { |
| 182 | let branch_name = "some_branch_2"; |
| 183 | create_branch(&repo, branch_name); |
| 184 | checkout_branch(&repo, branch_name); |
| 185 | }; |
| 186 | |
| 187 | { |
| 188 | assert_eq!(&get_current_branch_name(&repo), "some_branch_2"); |
| 189 | |
| 190 | // create new file |
| 191 | create_new_file(&path_to_repo, "file_2.txt", "contents 2"); |
| 192 | |
| 193 | // add commit to branch some_branch_2 |
nothing calls this directly
no test coverage detected