summary history branches tags files
commit:3d3eda5bdcae8ef0eb37e06f6a6061d4b90c20ac
author:Trevor Bentley
committer:Trevor Bentley
date:Thu Jan 12 15:32:00 2023 +0100
parents:a0ad8a861f0f5544f616b4babecf2aca11852fa7
fix repos not inheriting global settings
diff --git a/src/main.rs b/src/main.rs
line changes: +18/-3
index c305893..165a905
--- a/src/main.rs
+++ b/src/main.rs
@@ -942,13 +942,28 @@ fn main() {
     // save the ones that are successful.  If no repo name is
     // specified, use the TOML table name.
     let mut repo_descriptions: HashSet<GitsySettingsRepo> = HashSet::new();
+    macro_rules! global_to_repo {
+        ($settings:ident, $repo:ident, $field:ident) => {
+            if $repo.$field.is_none() { $repo.$field = $settings.$field.clone() }
+        }
+    }
     for k in &table_keys {
         let v = settings_raw.get(k).unwrap();
         match toml::from_str::<GitsySettingsRepo>(&v.to_string()) {
             Ok(mut repo) => {
-                if repo.name.is_none() {
-                    repo.name = Some(k.clone());
-                }
+                if repo.name.is_none() { repo.name = Some(k.clone()); }
+                global_to_repo!(settings, repo, render_markdown);
+                global_to_repo!(settings, repo, syntax_highlight);
+                global_to_repo!(settings, repo, syntax_highlight_theme);
+                global_to_repo!(settings, repo, limit_history);
+                global_to_repo!(settings, repo, limit_commits);
+                global_to_repo!(settings, repo, limit_branches);
+                global_to_repo!(settings, repo, limit_tags);
+                global_to_repo!(settings, repo, limit_tree_depth);
+                global_to_repo!(settings, repo, limit_file_size);
+                global_to_repo!(settings, repo, limit_repo_size);
+                global_to_repo!(settings, repo, limit_total_size);
+
                 repo_descriptions.insert(repo);
             },
             Err(e) => {