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

Function git_branch_paths

atomic-cli/src/commands/git/shim.rs:1563–1579  ·  view source on GitHub ↗
(git: &GitRepository, branch: &str)

Source from the content-addressed store, hash-verified

1561}
1562
1563fn git_branch_paths(git: &GitRepository, branch: &str) -> CliResult<BTreeSet<String>> {
1564 let reference_name = format!("refs/heads/{branch}");
1565 let tree = git
1566 .find_reference(&reference_name)
1567 .and_then(|reference| reference.peel_to_commit())
1568 .and_then(|commit| commit.tree())
1569 .map_err(|error| {
1570 if error.code() == git2::ErrorCode::NotFound {
1571 git_error(format!(
1572 "target Git branch '{branch}' does not exist; shim switch requires an existing target branch"
1573 ))
1574 } else {
1575 git_error(format!("cannot read target Git branch '{branch}': {error}"))
1576 }
1577 })?;
1578 Ok(read_git_tree(git, &tree)?.into_keys().collect())
1579}
1580
1581fn plan_switch_collisions(
1582 root: &Path,

Callers 1

switch_transactionFunction · 0.85

Calls 5

read_git_treeFunction · 0.85
treeMethod · 0.80
git_errorFunction · 0.70
codeMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected