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

Method target_branch

atomic-cli/src/commands/git/push.rs:668–677  ·  view source on GitHub ↗

The git branch the push will land on: the resolved `override_branch` (explicit `--branch` or a draft view's mapped branch) if present, else the currently checked-out branch.

(&self, git_repo: &GitRepository, override_branch: Option<&str>)

Source from the content-addressed store, hash-verified

666 /// (explicit `--branch` or a draft view's mapped branch) if present, else
667 /// the currently checked-out branch.
668 fn target_branch(&self, git_repo: &GitRepository, override_branch: Option<&str>) -> String {
669 if let Some(branch) = override_branch {
670 return branch.to_string();
671 }
672 git_repo
673 .head()
674 .ok()
675 .and_then(|h| h.shorthand().ok().map(str::to_owned))
676 .unwrap_or_else(|| "HEAD".to_string())
677 }
678
679 /// Count commits on `branch_name` that haven't been pushed to the push
680 /// target. The comparison point is the branch's configured upstream,

Callers 1

runMethod · 0.80

Calls 2

okMethod · 0.45
headMethod · 0.45

Tested by

no test coverage detected