diff --git a/src/config.rs b/src/config.rs index 8d28cee..a035fe6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,12 +19,16 @@ use crate::error::BadConfig; pub struct Config { pub sources: Vec, pub family_name: Option, - #[serde(default)] + #[serde(default = "true_")] pub build_variable: bool, #[serde(default)] pub axis_order: Vec, } +fn true_() -> bool { + true +} + impl Config { /// Parse and return a config.yaml file for the provided font source pub fn load(config_path: &Path) -> Result { diff --git a/src/lib.rs b/src/lib.rs index 8c25b77..7292953 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -45,8 +45,8 @@ mod repo_info; pub use args::Args; pub use config::Config; -pub use error::{BadConfig, LoadRepoError}; -use error::{Error, GitFail, MetadataError, UnwrapOrDie}; +pub use error::{BadConfig, Error, GitFail, LoadRepoError}; +use error::{MetadataError, UnwrapOrDie}; use metadata::Metadata; pub use repo_info::RepoInfo; @@ -329,6 +329,8 @@ fn config_files_from_local_checkout( local_repo_dir: &Path, ) -> Result, ConfigFetchIssue> { if local_repo_dir.exists() { + // try fetch; but failure is okay + let _ = fetch_latest(local_repo_dir); // should we always fetch? idk } else { std::fs::create_dir_all(local_repo_dir).unwrap(); diff --git a/src/metadata.rs b/src/metadata.rs index 1d3bcd0..a4d1d99 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -45,6 +45,7 @@ impl FromStr for Metadata { let repo_url = s .find(REPO_KEY) .and_then(|pos| extract_litstr(&s[pos + REPO_KEY.len()..])) + .map(|s| s.trim_end_matches('/')) // trailing / is not meaningful for a url .filter(|s| !s.is_empty()) .map(str::to_owned); Ok(Metadata { name, repo_url })