Skip to content

Commit

Permalink
Fix issue with git url canonicalization (#182)
Browse files Browse the repository at this point in the history
* Fix issue with git url canonicalization

Non-github.com urls ending in .git were being placed in the wrong
directory due to a bug in tame-index

* Only set path for non-github urls

* Update CHANGELOG
  • Loading branch information
Jake-Shadle authored Aug 15, 2023
1 parent 13ae95e commit 310f108
Show file tree
Hide file tree
Showing 5 changed files with 526 additions and 240 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- next-header -->
## [Unreleased] - ReleaseDate
- [PR#182](https://github.com/EmbarkStudios/cargo-fetcher/pull/182) fixed an issue where non-github.com urls ending in `.git` were not properly synced to disk.

## [0.14.0] - 2023-08-11
### Added
- [PR#178](https://github.com/EmbarkStudios/cargo-fetcher/pull/174) resolved [#177](https://github.com/EmbarkStudios/cargo-fetcher/issues/177) by adding support for sparse indices. This was further improved in [PR#180](https://github.com/EmbarkStudios/cargo-fetcher/pull/180) by using `tame-index` for registry index operations.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,16 @@ impl Source {
} = tame_index::utils::url_to_local_dir(url.as_str())?;

Ok(Source::Git(GitSource {
url: canonical.parse()?,
// Note just like cargo, the canonical url is only used for hashing
// purposes, it always uses the url exactly as provided by the user
// for actual network requests
url: {
let mut curl: Url = canonical.parse().context("failed to parse canonical url")?;
if url.host_str() != Some("github.com") {
curl.set_path(url.path());
}
curl
},
ident: dir_name,
rev,
follow,
Expand Down
Loading

0 comments on commit 310f108

Please sign in to comment.