Skip to content

Commit 437e5d7

Browse files
committed
Strip .git from urls on GitHub fast-path
1 parent 869642b commit 437e5d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/cargo/sources/git/utils.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,14 @@ fn github_up_to_date(
989989
anyhow::bail!("too many segments on URL");
990990
}
991991

992+
// Trim off the `.git` from the repository, if present, since that's
993+
// optional for GitHub and won't work when we try to use the API as well.
994+
let repository = if repository.ends_with(".git") {
995+
&repository[..repository.len() - 4]
996+
} else {
997+
repository
998+
};
999+
9921000
let url = format!(
9931001
"https://api.github.com/repos/{}/{}/commits/{}",
9941002
username, repository, github_branch_name,

0 commit comments

Comments
 (0)