Skip to content

Commit

Permalink
handle sufix .git in repo url
Browse files Browse the repository at this point in the history
- github strips `.git` suffixes when attempting to create a new repo ending in `.git` so this should be unambiguouse
- for other repos I hope they also don't allow creating repos with names ending in `.git`
  • Loading branch information
Skgland committed Jan 12, 2025
1 parent 8f8182e commit a3b18eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/crates/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl TryFrom<&'_ PackageId> for Crate {

Ok(Crate::GitHub(GitHubRepo {
org: org.to_string(),
name: repo_name.to_string(),
name: repo_name.trim_end_matches(".git").to_string(),
sha: match rev {
GitReference::Rev(rev)
if rev.chars().all(|c| c.is_ascii_hexdigit()) =>
Expand Down Expand Up @@ -212,7 +212,7 @@ impl TryFrom<&'_ PackageId> for Crate {

Ok(Crate::GitHub(GitHubRepo {
org: org.to_string(),
name: repo_name.to_string(),
name: repo_name.trim_end_matches(".git").to_string(),
sha: None,
}))
} else {
Expand Down

0 comments on commit a3b18eb

Please sign in to comment.