MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / clone_local

Function clone_local

src/git_operations.rs:497–517  ·  view source on GitHub ↗

Clone a local repository without hardlinks This creates an optimized copy of the source repository at the destination path. The clone operation repacks objects efficiently, typically resulting in 1-2 pack files instead of preserving fragmented pack structure. # Arguments `source_repo_path` - Path to the source repository to clone `destination_path` - Path where the cloned repository will be cre

(source_repo_path: &Path, destination_path: &Path)

Source from the content-addressed store, hash-verified

495/// - The destination path cannot be created
496/// - The clone operation fails
497pub async fn clone_local(source_repo_path: &Path, destination_path: &Path) -> Result<(), String> {
498 tokio::task::spawn_blocking({
499 let source_repo_path = source_repo_path.to_owned();
500 let destination_path = destination_path.to_owned();
501 move || -> Result<(), String> {
502 let mut builder = git2::build::RepoBuilder::new();
503 builder.clone_local(git2::build::CloneLocal::NoLinks);
504
505 builder
506 .clone(
507 source_repo_path.to_str().ok_or("Invalid source path")?,
508 &destination_path,
509 )
510 .map_err(|e| format!("Failed to clone repository: {e}"))?;
511
512 Ok(())
513 }
514 })
515 .await
516 .map_err(|e| format!("Task join error: {e}"))?
517}
518
519/// Initializes and checks out all submodules recursively in a repository.
520///

Callers 2

test_clone_localFunction · 0.85
copy_repoMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_clone_localFunction · 0.68