Skip to content

Commit

Permalink
feat: use full URL for embedded script paths
Browse files Browse the repository at this point in the history
Signed-off-by: Rustin170506 <[email protected]>
  • Loading branch information
Rustin170506 committed Jan 2, 2025
1 parent 0c2bb4e commit fc25d9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/cargo/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1800,7 +1800,10 @@ impl<'gctx> Packages<'gctx> {
match self.packages.entry(key.to_path_buf()) {
Entry::Occupied(e) => Ok(e.into_mut()),
Entry::Vacant(v) => {
let source_id = SourceId::for_path(key)?;
let source_id = match crate::util::toml::is_embedded(manifest_path) {
true => SourceId::for_path(manifest_path)?,
false => SourceId::for_path(key)?,
};
let manifest = read_manifest(manifest_path, source_id, self.gctx)?;
Ok(v.insert(match manifest {
EitherManifest::Real(manifest) => {
Expand Down
3 changes: 1 addition & 2 deletions tests/testsuite/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1307,11 +1307,10 @@ fn cmd_pkgid_with_embedded() {
.masquerade_as_nightly_cargo(&["script"])
.run();

// FIXME: It should be `path+[ROOTURL]/foo/script.rs#[email protected]`.
p.cargo("-Zscript pkgid --manifest-path script.rs")
.masquerade_as_nightly_cargo(&["script"])
.with_stdout_data(str![[r#"
path+[ROOTURL]/foo#[email protected]
path+[ROOTURL]/foo/script.rs#[email protected]
"#]])
.with_stderr_data(str![[r#"
Expand Down

0 comments on commit fc25d9d

Please sign in to comment.