Allow reviewing of agent changes without Git (#27668)

Release Notes:

- N/A
This commit is contained in:
Antonio Scandurra 2025-03-28 19:58:53 +01:00 committed by GitHub
parent 8a307e7b89
commit 94ed0b7767
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 2271 additions and 1095 deletions

View file

@ -5,8 +5,8 @@ use futures::future::{self, BoxFuture};
use git::{
blame::Blame,
repository::{
AskPassSession, Branch, CommitDetails, GitIndex, GitRepository, GitRepositoryCheckpoint,
PushOptions, Remote, RepoPath, ResetMode,
AskPassSession, Branch, CommitDetails, GitRepository, GitRepositoryCheckpoint, PushOptions,
Remote, RepoPath, ResetMode,
},
status::{FileStatus, GitStatus, StatusCode, TrackedStatus, UnmergedStatus},
};
@ -81,15 +81,7 @@ impl FakeGitRepository {
impl GitRepository for FakeGitRepository {
fn reload_index(&self) {}
fn load_index_text(
&self,
index: Option<GitIndex>,
path: RepoPath,
) -> BoxFuture<Option<String>> {
if index.is_some() {
unimplemented!();
}
fn load_index_text(&self, path: RepoPath) -> BoxFuture<Option<String>> {
async {
self.with_state_async(false, move |state| {
state
@ -179,19 +171,6 @@ impl GitRepository for FakeGitRepository {
self.path()
}
fn status(
&self,
index: Option<GitIndex>,
path_prefixes: &[RepoPath],
) -> BoxFuture<'static, Result<GitStatus>> {
if index.is_some() {
unimplemented!();
}
let status = self.status_blocking(path_prefixes);
async move { status }.boxed()
}
fn status_blocking(&self, path_prefixes: &[RepoPath]) -> Result<GitStatus> {
let workdir_path = self.dot_git_path.parent().unwrap();
@ -457,12 +436,4 @@ impl GitRepository for FakeGitRepository {
) -> BoxFuture<Result<String>> {
unimplemented!()
}
fn create_index(&self) -> BoxFuture<Result<GitIndex>> {
unimplemented!()
}
fn apply_diff(&self, _index: GitIndex, _diff: String) -> BoxFuture<Result<()>> {
unimplemented!()
}
}