refactor: mark RepositoryConfig::name private (#1125)

This commit is contained in:
Meng Zhang 2023-12-27 18:10:49 +08:00 committed by GitHub
parent 8d20068e34
commit e2eda29e3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -45,11 +45,19 @@ impl Config {
#[derive(Serialize, Deserialize)]
pub struct RepositoryConfig {
#[serde(skip_serializing_if = "Option::is_none")]
pub name: Option<String>,
name: Option<String>,
pub git_url: String,
}
impl RepositoryConfig {
#[cfg(feature = "testutils")]
pub fn new(git_url: String) -> Self {
Self {
name: None,
git_url,
}
}
pub fn dir(&self) -> PathBuf {
if self.is_local_dir() {
let path = self.git_url.strip_prefix("file://").unwrap();

View File

@ -17,10 +17,9 @@ mod tests {
set_tabby_root(root.to_path_buf());
let config = Config {
repositories: vec![RepositoryConfig {
name: None,
git_url: "https://github.com/TabbyML/interview-questions".to_owned(),
}],
repositories: vec![RepositoryConfig::new(
"https://github.com/TabbyML/interview-questions".to_owned(),
)],
server: ServerConfig::default(),
};