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

Function backup_subcommand

tests/backup.rs:15–196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13
14#[test]
15fn backup_subcommand() {
16 let repo_name = "backup_subcommand";
17 let repo = setup_git_repo(repo_name);
18 let path_to_repo = generate_path_to_repo(repo_name);
19
20 {
21 // create new file
22 create_new_file(&path_to_repo, "hello_world.txt", "Hello, world!");
23
24 // add first commit to master
25 first_commit_all(&repo, "first commit");
26 };
27
28 assert_eq!(&get_current_branch_name(&repo), "master");
29
30 // create and checkout new branch named not_part_of_any_chain
31 {
32 let branch_name = "not_part_of_any_chain";
33 create_branch(&repo, branch_name);
34 checkout_branch(&repo, branch_name);
35 };
36
37 {
38 // create new file
39 create_new_file(&path_to_repo, "not_part_of_any_chain.txt", "contents");
40
41 // add commit to branch not_part_of_any_chain
42 commit_all(&repo, "message");
43 };
44 assert_eq!(&get_current_branch_name(&repo), "not_part_of_any_chain");
45
46 // create and checkout new branch named some_branch_1
47 {
48 checkout_branch(&repo, "master");
49 let branch_name = "some_branch_1";
50 create_branch(&repo, branch_name);
51 checkout_branch(&repo, branch_name);
52 };
53
54 {
55 // create new file
56 create_new_file(&path_to_repo, "file_1.txt", "contents 1");
57
58 // add commit to branch some_branch_1
59 commit_all(&repo, "message");
60 };
61
62 // init subcommand with chain name, and use master as the root branch
63 assert_eq!(&get_current_branch_name(&repo), "some_branch_1");
64
65 let args: Vec<&str> = vec!["init", "chain_name", "master"];
66 run_test_bin_expect_ok(&path_to_repo, args);
67
68 // create and checkout new branch named some_branch_2
69 {
70 checkout_branch(&repo, "master");
71 let branch_name = "some_branch_2";
72 create_branch(&repo, branch_name);

Callers

nothing calls this directly

Calls 9

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_bin_expect_okFunction · 0.85
teardown_git_repoFunction · 0.85

Tested by

no test coverage detected