MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / init_git_with_feature

Function init_git_with_feature

atomic-cli/tests/it/git_shim_cb0d_test.rs:82–102  ·  view source on GitHub ↗
(root: &Path)

Source from the content-addressed store, hash-verified

80}
81
82fn init_git_with_feature(root: &Path) -> (Oid, Oid) {
83 let repository = init_git(root);
84 let main = commit_file(&repository, "tracked.txt", b"main\n", "main");
85 let main_commit = repository.find_commit(main).expect("main commit");
86 repository
87 .branch("feature", &main_commit, false)
88 .expect("feature branch");
89 drop(main_commit);
90 repository
91 .set_head("refs/heads/feature")
92 .expect("attach feature");
93 repository
94 .checkout_head(Some(git2::build::CheckoutBuilder::new().force()))
95 .expect("checkout feature");
96 let feature = commit_file(&repository, "tracked.txt", b"feature\n", "feature");
97 repository.set_head("refs/heads/main").expect("attach main");
98 repository
99 .checkout_head(Some(git2::build::CheckoutBuilder::new().force()))
100 .expect("checkout main");
101 (main, feature)
102}
103
104fn run_git(root: &Path, args: &[&str]) -> Output {
105 Command::new("git")

Calls 4

forceMethod · 0.80
init_gitFunction · 0.70
commit_fileFunction · 0.70
branchMethod · 0.45

Tested by

no test coverage detected