Skip to content

Commit beeac46

Browse files
committed
fix: create ephemeral workspace for git source
1 parent db02d39 commit beeac46

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/cargo/core/workspace.rs

+4
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ impl<'gctx> Workspace<'gctx> {
283283
ws.member_ids.insert(id);
284284
ws.default_members.push(ws.current_manifest.clone());
285285
ws.set_resolve_behavior();
286+
// The find_root function is used here to traverse the directory tree and locate the root of the workspace.
287+
// Despite being ephemeral, we still need to validate all the manifests in the workspace,
288+
// which is what `find_root` helps us achieve here.
289+
ws.find_root(ws.current_manifest.clone().as_path())?;
286290
Ok(ws)
287291
}
288292

src/cargo/ops/cargo_install.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ fn make_ws_rustc_target<'gctx>(
816816
source_id: &SourceId,
817817
pkg: Package,
818818
) -> CargoResult<(Workspace<'gctx>, Rustc, String)> {
819-
let mut ws = if source_id.is_git() || source_id.is_path() {
819+
let mut ws = if source_id.is_path() {
820820
Workspace::new(pkg.manifest_path(), gctx)?
821821
} else {
822822
Workspace::ephemeral(pkg, gctx, None, false)?

tests/testsuite/install.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2124,6 +2124,7 @@ fn git_install_the_same_bin_twice_with_different_rev() {
21242124
"\
21252125
[UPDATING] git repository [..]
21262126
[INSTALLING] bin1 v0.1.0 [..]
2127+
[COMPILING] bin1 v0.1.0 [..]
21272128
[FINISHED] [..]
21282129
[REPLACING] [..]home/.cargo/bin/bin1[..]
21292130
[REPLACED] package `bin1 [..]

0 commit comments

Comments
 (0)