Rename GitRepository.path()
to GitRepository.dot_git_dir()
(#22026)
Release Notes: - N/A
This commit is contained in:
parent
25970650a7
commit
d459f010b6
2 changed files with 11 additions and 10 deletions
|
@ -46,7 +46,8 @@ pub trait GitRepository: Send + Sync {
|
|||
|
||||
fn blame(&self, path: &Path, content: Rope) -> Result<crate::blame::Blame>;
|
||||
|
||||
fn path(&self) -> PathBuf;
|
||||
/// Returns the path to the repository, typically the `.git` folder.
|
||||
fn dot_git_dir(&self) -> PathBuf;
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for dyn GitRepository {
|
||||
|
@ -85,7 +86,7 @@ impl GitRepository for RealGitRepository {
|
|||
}
|
||||
}
|
||||
|
||||
fn path(&self) -> PathBuf {
|
||||
fn dot_git_dir(&self) -> PathBuf {
|
||||
let repo = self.repository.lock();
|
||||
repo.path().into()
|
||||
}
|
||||
|
@ -233,7 +234,7 @@ pub struct FakeGitRepository {
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct FakeGitRepositoryState {
|
||||
pub path: PathBuf,
|
||||
pub dot_git_dir: PathBuf,
|
||||
pub event_emitter: smol::channel::Sender<PathBuf>,
|
||||
pub index_contents: HashMap<PathBuf, String>,
|
||||
pub blames: HashMap<PathBuf, Blame>,
|
||||
|
@ -249,9 +250,9 @@ impl FakeGitRepository {
|
|||
}
|
||||
|
||||
impl FakeGitRepositoryState {
|
||||
pub fn new(path: PathBuf, event_emitter: smol::channel::Sender<PathBuf>) -> Self {
|
||||
pub fn new(dot_git_dir: PathBuf, event_emitter: smol::channel::Sender<PathBuf>) -> Self {
|
||||
FakeGitRepositoryState {
|
||||
path,
|
||||
dot_git_dir,
|
||||
event_emitter,
|
||||
index_contents: Default::default(),
|
||||
blames: Default::default(),
|
||||
|
@ -283,9 +284,9 @@ impl GitRepository for FakeGitRepository {
|
|||
None
|
||||
}
|
||||
|
||||
fn path(&self) -> PathBuf {
|
||||
fn dot_git_dir(&self) -> PathBuf {
|
||||
let state = self.state.lock();
|
||||
state.path.clone()
|
||||
state.dot_git_dir.clone()
|
||||
}
|
||||
|
||||
fn status(&self, path_prefixes: &[PathBuf]) -> Result<GitStatus> {
|
||||
|
@ -334,7 +335,7 @@ impl GitRepository for FakeGitRepository {
|
|||
state.current_branch_name = Some(name.to_owned());
|
||||
state
|
||||
.event_emitter
|
||||
.try_send(state.path.clone())
|
||||
.try_send(state.dot_git_dir.clone())
|
||||
.expect("Dropped repo change event");
|
||||
Ok(())
|
||||
}
|
||||
|
@ -344,7 +345,7 @@ impl GitRepository for FakeGitRepository {
|
|||
state.branches.insert(name.to_owned());
|
||||
state
|
||||
.event_emitter
|
||||
.try_send(state.path.clone())
|
||||
.try_send(state.dot_git_dir.clone())
|
||||
.expect("Dropped repo change event");
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue