Unified · Split
| @@ -48,17 +48,22 @@ impl RepositoryUrl { · 47 unmodified lines | ||
| 48 | 48 | self.inner.host.as_ref().map(|h| h == "github.com").unwrap_or(false) |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | + fn cleaned_path(&self) -> String { | |
| 52 | + let path = self.inner.path.to_str_lossy().into_owned(); | |
| 53 | + path.strip_suffix(".git").map(ToOwned::to_owned).unwrap_or(path) | |
| 54 | + } | |
| 55 | + | |
| 51 | 56 | pub fn github_https(&self) -> Option<String> { |
| 52 | 57 | match &self.inner.host { |
| 53 | 58 | Some(host) if host == "github.com" => match self.inner.scheme { |
| 54 | 59 | Scheme::Http | Scheme::Https | Scheme::Git => { |
| 55 | − format!("https://github.com{}", self.inner.path.to_str_lossy()).into() | |
| 60 | + format!("https://github.com{}", self.cleaned_path()).into() | |
| 56 | 61 | } |
| 57 | 62 | Scheme::Ssh => self |
| 58 | 63 | .inner |
| 59 | 64 | .user |
| 60 | 65 | .as_ref() |
| 61 | − .map(|user| format!("https://github.com{}/{}", user, self.inner.path.to_str_lossy())), | |
| 66 | + .map(|user| format!("https://github.com{}/{}", user, self.cleaned_path())), | |
| 62 | 67 | Scheme::Radicle | Scheme::File => None, |
| 63 | 68 | }, |
| 64 | 69 | None | Some(_) => None, |
| @@ -53,7 +53,7 @@ fn conventional_write_empty_messages() -> Result { · 52 unmodified lines | ||
| 53 | 53 | for link_mode in &[ |
| 54 | 54 | changelog::write::Linkables::AsText, |
| 55 | 55 | changelog::write::Linkables::AsLinks { |
| 56 | − repository_url: git_repository::Url::try_from(b"https://github.com/user/repo".as_bytes())?.into(), | |
| 56 | + repository_url: git_repository::Url::try_from(b"https://github.com/user/repo.git".as_bytes())?.into(), | |
| 57 | 57 | }, |
| 58 | 58 | ] { |
| 59 | 59 | let log = log.clone(); |