fix(config): deserialise gitdir as PathBuf, but expose it as GitDir
All checks were successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful

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