feat: init
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
pub mod blame;
|
||||
pub mod branch;
|
||||
pub mod commit;
|
||||
pub mod diff;
|
||||
pub mod merge;
|
||||
pub mod repository;
|
||||
pub mod tag;
|
||||
pub mod tree;
|
||||
|
||||
use crate::error::AppError;
|
||||
use crate::models::repos::Repo;
|
||||
use crate::models::workspaces::Workspace;
|
||||
use crate::pb::RepoClient;
|
||||
use crate::pb::repo::RepositoryHeader;
|
||||
use crate::service::RepoService;
|
||||
|
||||
impl RepoService {
|
||||
pub(crate) fn repo_header(&self, repo: &Repo, ws: &Workspace) -> RepositoryHeader {
|
||||
RepositoryHeader {
|
||||
storage_name: ws.name.clone(),
|
||||
relative_path: format!("{}.git", repo.name),
|
||||
storage_path: repo.storage_path.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn git_client(&self, repo: &Repo) -> Result<RepoClient, AppError> {
|
||||
self.ctx
|
||||
.registry
|
||||
.get_git_client(&repo.primary_storage_node_id)
|
||||
.ok_or_else(|| AppError::Config("primary git node not available".into()))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user