MCPcopy Index your code
hub / github.com/dashed/git-chain / push_subcommand_force

Function push_subcommand_force

tests/push.rs:136–255  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134
135#[test]
136fn 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

Callers

nothing calls this directly

Calls 13

setup_git_repoFunction · 0.85
setup_git_bare_repoFunction · 0.85
generate_path_to_repoFunction · 0.85
run_git_commandFunction · 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_bin_expect_okFunction · 0.85
teardown_git_repoFunction · 0.85

Tested by

no test coverage detected