From 105d96a60180570789455aeae8bbe9aa0e8af396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christina=20S=C3=B8rensen?= Date: Mon, 24 Jul 2023 07:00:48 +0200 Subject: [PATCH] feat: handle category without repos MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a dirty hack, but we won't have to duplicate it when the kinds field is done, so I don't feel /too/ bad about including it :D Signed-off-by: Christina Sørensen --- src/git.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/git.rs b/src/git.rs index 5ecd522..aea03b1 100644 --- a/src/git.rs +++ b/src/git.rs @@ -600,8 +600,13 @@ impl Config { /// ]; /// ``` pub fn all_on_all(&self, closures: Vec, break_on_err: bool) { + // HACK: creates a empty repo, that is used if a category doesn't have + // any repos or don't define the repo field + let tmp: HashMap = HashMap::new(); + for category in self.categories.values() { - for (_, repo) in category.repos.as_ref().expect("failed to get repos").iter() { + // HACK: if the repo doesn't exist here, we inject tmp + for (_, repo) in category.repos.as_ref().unwrap_or_else(|| &tmp).iter() { use RepoKinds::*; match &repo.kind { Some(GitRepo) => {