diff options
Diffstat (limited to 'src/config')
-rw-r--r-- | src/config/mod.rs | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 07c6c29..f9ae103 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -16,6 +16,7 @@ use std::{ }; use git_bug::{entities::issue::Issue, replica::Replica}; +use log::info; use serde::Deserialize; use url::Url; @@ -81,6 +82,7 @@ impl BackRepositories { #[derive(Debug)] pub struct BackRepository { + /// The path to the repository, with a possible `.git` suffix stripped. repo_path: PathBuf, } @@ -139,9 +141,21 @@ impl BackConfig { })? .lines() .try_fold(vec![], |mut acc, path| { - acc.push(BackRepository { - repo_path: PathBuf::from(path), - }); + let mut path = PathBuf::from(path); + + let repo_path = if path + .extension() + .is_some_and(|ext| ext.eq_ignore_ascii_case("git")) + { + info!("Removing a `.git` suffix from path: {}", path.display()); + + path.set_extension(""); + path + } else { + path + }; + + acc.push(BackRepository { repo_path }); Ok::<_, Error>(acc) })?; |