Skip to content

Commit

Permalink
fix: strip .git suffix from repo path
Browse files Browse the repository at this point in the history
  • Loading branch information
justinrubek committed May 17, 2024
1 parent 594d039 commit 2ec393c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/changelog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,25 @@ fn gix_repo_url(repo: &gix::Repository) -> Result<Option<(String, String)>> {
let host = url.host_argument_safe();
let path = url.path_argument_safe();
match (host, path) {
(Some(host), Some(path)) => Ok(Some((host.to_string(), path.to_string()))),
(Some(host), Some(path)) => Ok(Some((
host.to_string(),
remove_suffix(&path.to_string(), ".git").to_string(),
))),
_ => Ok(None),
}
}
None => Ok(None),
}
}

fn remove_suffix<'a>(input: &'a str, suffix: &str) -> &'a str {
if let Some(stripped) = input.strip_suffix(suffix) {
stripped
} else {
input
}
}

fn author_name(
commit_author: String,
authors: &Option<HashMap<String, String>>,
Expand Down

0 comments on commit 2ec393c

Please sign in to comment.