Skip to content

Commit

Permalink
Fix root detection without workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
cd-work committed Sep 12, 2023
1 parent 780c53a commit 8acf975
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lockfile_generator/src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ pub struct Cargo;
impl Generator for Cargo {
fn lockfile_path(&self, manifest_path: &Path) -> Result<PathBuf> {
let cargo_config = Config::default()?;
let workspace_manifest = core::find_workspace_root(manifest_path, &cargo_config)?;
let root_manifest =
core::find_workspace_root(manifest_path, &cargo_config)?.unwrap_or_default();
workspace_manifest.as_ref().map(PathBuf::as_path).unwrap_or(manifest_path);
let workspace_root = root_manifest
.parent()
.ok_or_else(|| Error::InvalidManifest(root_manifest.to_path_buf()))?;
Expand Down

0 comments on commit 8acf975

Please sign in to comment.