MCPcopy Create free account
hub / github.com/GCWing/BitFun / git_get_branches

Function git_get_branches

src/apps/desktop/src/api/git_api.rs:686–713  ·  view source on GitHub ↗
(
    state: State<'_, AppState>,
    request: GitBranchesRequest,
)

Source from the content-addressed store, hash-verified

684
685#[tauri::command]
686pub async fn git_get_branches(
687 state: State<'_, AppState>,
688 request: GitBranchesRequest,
689) -> Result<Vec<GitBranch>, String> {
690 let include_remote = request.include_remote.unwrap_or(false);
691 if let Some(target) = resolve_remote_git_target(&request.repository_path).await {
692 let mut args = vec![
693 "for-each-ref".to_string(),
694 "--format=%(if)%(HEAD)%(then)*%(else) %(end)%09%(refname)%09%(refname:short)%09%(upstream:short)%09%(objectname)%09%(committerdate:iso-strict)".to_string(),
695 "refs/heads".to_string(),
696 ];
697 if include_remote {
698 args.push("refs/remotes".to_string());
699 }
700 let output = execute_remote_git_success(&state, &target, &args).await?;
701 return Ok(parse_remote_branches(&output));
702 }
703
704 GitService::get_branches(&request.repository_path, include_remote)
705 .await
706 .map_err(|e| {
707 error!(
708 "Failed to get Git branches: path={}, include_remote={}, error={}",
709 request.repository_path, include_remote, e
710 );
711 format!("Failed to get Git branches: {}", e)
712 })
713}
714
715#[tauri::command]
716pub async fn git_get_enhanced_branches(

Callers

nothing calls this directly

Calls 4

parse_remote_branchesFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected