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

Function git_branch_paths

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

Source from the content-addressed store, hash-verified

1605}
1606
1607fn git_branch_paths(git: &GitRepository, branch: &str) -> CliResult<BTreeSet<String>> {
1608 let reference_name = format!("refs/heads/{branch}");
1609 let tree = git
1610 .find_reference(&reference_name)
1611 .and_then(|reference| reference.peel_to_commit())
1612 .and_then(|commit| commit.tree())
1613 .map_err(|error| {
1614 if error.code() == git2::ErrorCode::NotFound {
1615 git_error(format!(
1616 "target Git branch '{branch}' does not exist; shim switch requires an existing target branch"
1617 ))
1618 } else {
1619 git_error(format!("cannot read target Git branch '{branch}': {error}"))
1620 }
1621 })?;
1622 Ok(read_git_tree(git, &tree)?.into_keys().collect())
1623}
1624
1625fn plan_switch_collisions(
1626 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