WIP, re-doing fs and fake git repos
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use anyhow::{anyhow, Result};
|
||||
use fsevent::EventStream;
|
||||
use futures::{future::BoxFuture, Stream, StreamExt};
|
||||
use git::repository::{FakeGitRepository, GitRepository, RealGitRepository};
|
||||
use language::LineEnding;
|
||||
use smol::io::{AsyncReadExt, AsyncWriteExt};
|
||||
use std::{
|
||||
@@ -43,6 +44,7 @@ pub trait Fs: Send + Sync {
|
||||
path: &Path,
|
||||
latency: Duration,
|
||||
) -> Pin<Box<dyn Send + Stream<Item = Vec<fsevent::Event>>>>;
|
||||
async fn open_repo(&self, abs_dot_git: &Path) -> Option<Box<dyn GitRepository>>;
|
||||
fn is_fake(&self) -> bool;
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
fn as_fake(&self) -> &FakeFs;
|
||||
@@ -236,6 +238,10 @@ impl Fs for RealFs {
|
||||
})))
|
||||
}
|
||||
|
||||
fn open_repo(&self, abs_dot_git: &Path) -> Option<Box<dyn GitRepository>> {
|
||||
RealGitRepository::open(&abs_dot_git)
|
||||
}
|
||||
|
||||
fn is_fake(&self) -> bool {
|
||||
false
|
||||
}
|
||||
@@ -847,6 +853,10 @@ impl Fs for FakeFs {
|
||||
}))
|
||||
}
|
||||
|
||||
fn open_repo(&self, abs_dot_git: &Path) -> Option<Box<dyn GitRepository>> {
|
||||
Some(FakeGitRepository::open(abs_dot_git.into(), 0))
|
||||
}
|
||||
|
||||
fn is_fake(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user