Skip to content

Commit a3b18eb

Browse files
committed
handle sufix .git in repo url
- 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`
1 parent 8f8182e commit a3b18eb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/crates/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl TryFrom<&'_ PackageId> for Crate {
141141

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

213213
Ok(Crate::GitHub(GitHubRepo {
214214
org: org.to_string(),
215-
name: repo_name.to_string(),
215+
name: repo_name.trim_end_matches(".git").to_string(),
216216
sha: None,
217217
}))
218218
} else {

0 commit comments

Comments
 (0)