Struct git_repository::ThreadSafeRepository
source · [−]pub struct ThreadSafeRepository {
pub refs: RefStore,
pub objects: OwnShared<Store>,
pub work_tree: Option<PathBuf>,
/* private fields */
}
Expand description
An instance with access to everything a git repository entails, best imagined as container implementing Sync + Send
for most
for system resources required to interact with a git
repository which are loaded in once the instance is created.
Use this type to reference it in a threaded context for creation the creation of a thread-local Repositories
.
Note that this type purposefully isn’t very useful until it is converted into a thread-local repository with to_thread_local()
,
it’s merely meant to be able to exist in a Sync
context.
Fields
refs: RefStore
A store for references to point at objects
objects: OwnShared<Store>
A store for objects that contain data
work_tree: Option<PathBuf>
The path to the worktree at which to find checked out files
Implementations
sourceimpl ThreadSafeRepository
impl ThreadSafeRepository
sourcepub fn to_thread_local(&self) -> Repository
pub fn to_thread_local(&self) -> Repository
Add thread-local state to an easy-to-use thread-local repository for the most convenient API.
sourceimpl ThreadSafeRepository
impl ThreadSafeRepository
sourcepub fn path(&self) -> &Path
pub fn path(&self) -> &Path
The path to the .git
directory itself, or equivalent if this is a bare repository.
sourcepub fn git_dir(&self) -> &Path
pub fn git_dir(&self) -> &Path
Return the path to the repository itself, containing objects, references, configuration, and more.
Synonymous to path()
.
sourcepub fn workdir(&self) -> Option<&Path>
pub fn workdir(&self) -> Option<&Path>
Return the path to the working directory if this is not a bare repository.
sourcepub fn objects_dir(&self) -> &Path
pub fn objects_dir(&self) -> &Path
Return the path to the directory containing all objects.
sourceimpl ThreadSafeRepository
impl ThreadSafeRepository
sourcepub fn init(directory: impl AsRef<Path>, kind: Kind) -> Result<Self, Error>
pub fn init(directory: impl AsRef<Path>, kind: Kind) -> Result<Self, Error>
Create a repository with work-tree within directory
, creating intermediate directories as needed.
Fails without action if there is already a .git
repository inside of directory
, but
won’t mind if the directory
otherwise is non-empty.
Trait Implementations
sourceimpl Debug for ThreadSafeRepository
impl Debug for ThreadSafeRepository
sourceimpl From<&'_ ThreadSafeRepository> for Repository
impl From<&'_ ThreadSafeRepository> for Repository
sourcefn from(repo: &ThreadSafeRepository) -> Self
fn from(repo: &ThreadSafeRepository) -> Self
Converts to this type from the input type.
sourceimpl From<Repository> for ThreadSafeRepository
impl From<Repository> for ThreadSafeRepository
sourcefn from(r: Repository) -> Self
fn from(r: Repository) -> Self
Converts to this type from the input type.
sourceimpl From<ThreadSafeRepository> for Repository
impl From<ThreadSafeRepository> for Repository
sourcefn from(repo: ThreadSafeRepository) -> Self
fn from(repo: ThreadSafeRepository) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for ThreadSafeRepository
impl Send for ThreadSafeRepository
impl Sync for ThreadSafeRepository
impl Unpin for ThreadSafeRepository
impl !UnwindSafe for ThreadSafeRepository
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more