fix(config): deserialise gitdir as PathBuf, but expose it as GitDir

This commit is contained in:
Paul Campbell 2024-04-21 18:54:36 +01:00
parent b71aece8c9
commit ee8b1e9fce

View file

@ -171,7 +171,7 @@ impl Display for ForgeConfig {
pub struct ServerRepoConfig { pub struct ServerRepoConfig {
repo: String, repo: String,
branch: String, branch: String,
gitdir: Option<GitDir>, gitdir: Option<PathBuf>,
main: Option<String>, main: Option<String>,
next: Option<String>, next: Option<String>,
dev: Option<String>, dev: Option<String>,
@ -199,8 +199,8 @@ impl ServerRepoConfig {
_ => None, _ => None,
} }
} }
pub const fn gitdir(&self) -> Option<&GitDir> { pub fn gitdir(&self) -> Option<GitDir> {
self.gitdir.as_ref() self.gitdir.clone().map(GitDir)
} }
} }
#[cfg(test)] #[cfg(test)]
@ -341,7 +341,7 @@ impl RepoDetails {
repo_path: RepoPath(server_repo_config.repo.clone()), repo_path: RepoPath(server_repo_config.repo.clone()),
config: server_repo_config.repo_config(), config: server_repo_config.repo_config(),
branch: BranchName(server_repo_config.branch.clone()), branch: BranchName(server_repo_config.branch.clone()),
gitdir: server_repo_config.gitdir().cloned(), gitdir: server_repo_config.gitdir(),
forge: ForgeDetails { forge: ForgeDetails {
name: forge_name.clone(), name: forge_name.clone(),
forge_type: forge.forge_type.clone(), forge_type: forge.forge_type.clone(),