From d7ba472ae3283f584fe4bad9dd6d3e142c91b85f Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Fri, 26 Jul 2024 16:33:07 +0200 Subject: [PATCH] Fix bug with path matching on git dependencies --- src/diag/krate_spans.rs | 5 ++++- tests/snapshots/bans__deny_duplicate_workspace_items.snap | 2 +- tests/test_data/workspace/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/diag/krate_spans.rs b/src/diag/krate_spans.rs index 0fe718be..8560a872 100644 --- a/src/diag/krate_spans.rs +++ b/src/diag/krate_spans.rs @@ -741,7 +741,10 @@ fn read_workspace_deps<'k>( }), Source::Git { repo, spec: dspec }, ) => { - if url.host_str() != repo.host_str() || url.path() != repo.path() { + if url.host_str() != repo.host_str() + || url.path().trim_end_matches(".git") + != repo.path().trim_end_matches(".git") + { return None; } diff --git a/tests/snapshots/bans__deny_duplicate_workspace_items.snap b/tests/snapshots/bans__deny_duplicate_workspace_items.snap index 84bd3fa4..6868d106 100644 --- a/tests/snapshots/bans__deny_duplicate_workspace_items.snap +++ b/tests/snapshots/bans__deny_duplicate_workspace_items.snap @@ -353,7 +353,7 @@ expression: diags "span": "spdx-git" }, { - "column": 87, + "column": 91, "line": 19, "message": "note the workspace dependency is renamed", "span": "spdx" diff --git a/tests/test_data/workspace/Cargo.toml b/tests/test_data/workspace/Cargo.toml index b174500b..dbb76bbf 100644 --- a/tests/test_data/workspace/Cargo.toml +++ b/tests/test_data/workspace/Cargo.toml @@ -16,7 +16,7 @@ spdx = "0.10" # Validates that we recognize the workspace dependency exists even though it is renamed spdx-old = { version = "0.9", package = "spdx" } spdx-very-old = { version = "0.8", package = "spdx" } -spdx-git = { git = "https://github.com/EmbarkStudios/spdx", tag = "0.7.0", package = "spdx" } +spdx-git = { git = "https://github.com/EmbarkStudios/spdx.git", tag = "0.7.0", package = "spdx" } member-one = { path = "crates/member-one" } member-two = { path = "crates/member-two" } # Validates we can find workspace dependency sources from non-crates.io registries