pub struct Workspace(pub PathBuf);
Expand description
Initialize the internal Lorry workspace reponsible for holding mirror and other relevant data. Workspace also contains a few lightweight methods that can return data about an existing mirror.
Directory structure:
git-repository # bare repository that contains mirrored upstream code raw-files # git worktree containing files synchronized via LFS
NOTE: Workspace methods are not asynchronous because these operations are all expected to take place on a single worker thread. Depending on the usage it may be desierable to wrap it in a tokio::Task. Since these are all IO operations and initialization steps blocking should be minimal.
Tuple Fields§
§0: PathBuf
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn new(working_dir: &Path, name: &str) -> Self
pub fn new(working_dir: &Path, name: &str) -> Self
Create a new Workspace based on the workdir and Lorry name
Sourcepub fn repository_path(&self) -> PathBuf
pub fn repository_path(&self) -> PathBuf
Return the path to the underlying git repository mirror
Sourcepub fn lfs_data_path(&self) -> PathBuf
pub fn lfs_data_path(&self) -> PathBuf
Return the path to the underlying LFS data directory
Sourcepub fn head(&self) -> Option<String>
pub fn head(&self) -> Option<String>
Return the HEAD of the repository within the workspace, NOTE: If the workspace as just initialized then the HEAD will always return None.
Sourcepub fn init_if_missing(
&self,
enable_lfs: bool,
bare: bool,
) -> Result<bool, Error>
pub fn init_if_missing( &self, enable_lfs: bool, bare: bool, ) -> Result<bool, Error>
Initialize the internal directories of the workspace if they are missing otherwise this operation is NOOP. Returns true if the repository was not already initialized and false if it was setup already. If bare is specified the repository will be managed as “bare” otherwise it will checkout repository contents of the main branch in the repo path.