Skip to content

Commit 310f108

Browse files
authored
Fix issue with git url canonicalization (#182)
* 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
1 parent 13ae95e commit 310f108

File tree

5 files changed

+526
-240
lines changed

5 files changed

+526
-240
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88

99
<!-- next-header -->
1010
## [Unreleased] - ReleaseDate
11+
- [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.
12+
1113
## [0.14.0] - 2023-08-11
1214
### Added
1315
- [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.

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cargo.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,16 @@ impl Source {
346346
} = tame_index::utils::url_to_local_dir(url.as_str())?;
347347

348348
Ok(Source::Git(GitSource {
349-
url: canonical.parse()?,
349+
// Note just like cargo, the canonical url is only used for hashing
350+
// purposes, it always uses the url exactly as provided by the user
351+
// for actual network requests
352+
url: {
353+
let mut curl: Url = canonical.parse().context("failed to parse canonical url")?;
354+
if url.host_str() != Some("github.com") {
355+
curl.set_path(url.path());
356+
}
357+
curl
358+
},
350359
ident: dir_name,
351360
rev,
352361
follow,

0 commit comments

Comments
 (0)