diff --git a/lib/src/repo.rs b/lib/src/repo.rs index 9b0512626..ba45ffcf8 100644 --- a/lib/src/repo.rs +++ b/lib/src/repo.rs @@ -53,15 +53,15 @@ use crate::{backend, op_store}; // RepoRef? #[derive(Clone, Copy)] pub enum RepoRef<'a> { - Readonly(&'a ReadonlyRepo), + Readonly(&'a Arc), Mutable(&'a MutableRepo), } impl<'a> RepoRef<'a> { - pub fn base_repo(&self) -> &ReadonlyRepo { + pub fn base_repo(&self) -> &Arc { match self { - RepoRef::Readonly(repo) => repo, - RepoRef::Mutable(repo) => repo.base_repo.as_ref(), + RepoRef::Readonly(repo) => &repo, + RepoRef::Mutable(repo) => &repo.base_repo, } } @@ -245,7 +245,7 @@ impl ReadonlyRepo { } } - pub fn as_repo_ref(&self) -> RepoRef { + pub fn as_repo_ref<'a>(self: &'a Arc) -> RepoRef<'a> { RepoRef::Readonly(self) } diff --git a/lib/src/transaction.rs b/lib/src/transaction.rs index 16db09a60..9e096af4c 100644 --- a/lib/src/transaction.rs +++ b/lib/src/transaction.rs @@ -48,7 +48,7 @@ impl Transaction { } } - pub fn base_repo(&self) -> &ReadonlyRepo { + pub fn base_repo(&self) -> &Arc { self.mut_repo.base_repo() } diff --git a/src/cli_util.rs b/src/cli_util.rs index 6bf651b4b..6969331ee 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -1017,7 +1017,7 @@ impl WorkspaceCommandTransaction<'_> { self.helper } - pub fn base_repo(&self) -> &ReadonlyRepo { + pub fn base_repo(&self) -> &Arc { self.tx.base_repo() }