MCPcopy Index your code
hub / github.com/AI45Lab/Code / checkout

Method checkout

core/src/workspace/local.rs:351–369  ·  view source on GitHub ↗
(
        &self,
        request: WorkspaceGitCheckoutRequest,
    )

Source from the content-addressed store, hash-verified

349 }
350
351 async fn checkout(
352 &self,
353 request: WorkspaceGitCheckoutRequest,
354 ) -> Result<WorkspaceGitCheckoutOutput> {
355 let args = if request.force {
356 vec![
357 "checkout".to_string(),
358 "--force".to_string(),
359 request.refspec,
360 ]
361 } else {
362 vec!["checkout".to_string(), request.refspec]
363 };
364 let (success, stdout, stderr) = self.run_git_command(args).await?;
365 if !success {
366 bail!("{}", stderr.trim_end());
367 }
368 Ok(WorkspaceGitCheckoutOutput { stdout })
369 }
370
371 async fn diff(&self, request: WorkspaceGitDiffRequest) -> Result<String> {
372 self.run_blocking_git(move |root| crate::git::get_diff(&root, request.target.as_deref()))

Callers

nothing calls this directly

Calls 1

run_git_commandMethod · 0.80

Tested by

no test coverage detected