Skip to content

Commit

Permalink
misc: fix serde test
Browse files Browse the repository at this point in the history
  • Loading branch information
nichmor committed Dec 18, 2024
1 parent 01332e6 commit 18d338d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
10 changes: 8 additions & 2 deletions crates/pixi_git/src/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,21 @@ impl RepositoryUrl {
let mut url = CanonicalUrl::new(url).0;

// If a Git URL ends in a reference (like a branch, tag, or commit), remove it.
if url.scheme().starts_with("git+") {
let mut url = if url.scheme().starts_with("git+") {
if let Some(prefix) = url
.path()
.rsplit_once('@')
.map(|(prefix, _suffix)| prefix.to_string())
{
url.set_path(&prefix);
}
}

// Remove the `git+` prefix.
let url_as_str = &url.as_str()[4..];
Url::parse(url_as_str).expect("url should be valid")
} else {
url
};

// Drop any fragments and query parameters.
url.set_fragment(None);
Expand Down
4 changes: 3 additions & 1 deletion crates/pixi_record/src/pinned_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,9 @@ mod tests {

let result = locked_git_spec.satisfies(&requested_git_spec_with_prefix);

assert!(result.is_ok());
result.unwrap();

// assert!(result.is_ok());
}

#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ expression: snapshot
- input:
ver: 1.2.3
result:
error: "ERROR: unknown field `ver`, expected one of `version`, `url`, `git`, `path`, `branch`, `rev`, `tag`, `build`, `build-number`, `file-name`, `channel`, `subdir`, `md5`, `sha256`"
error: "ERROR: unknown field `ver`, expected one of `version`, `url`, `git`, `path`, `branch`, `rev`, `tag`, `subdirectory`, `build`, `build-number`, `file-name`, `channel`, `subdir`, `md5`, `sha256`"
- input:
path: foobar
version: 1.2.3
Expand Down

0 comments on commit 18d338d

Please sign in to comment.