Skip to content

Commit 1f46935

Browse files
fix(fil-proofs-tooling): fallback for missing cargo env in benchy
1 parent 3e02361 commit 1f46935

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fil-proofs-tooling/src/metadata.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ pub struct GitMetadata {
3232

3333
impl GitMetadata {
3434
pub fn new() -> Result<Self, Error> {
35-
let repo_path = std::env::var("CARGO_MANIFEST_DIR")?;
35+
let repo_path = if let Ok(mdir) = std::env::var("CARGO_MANIFEST_DIR") {
36+
std::path::Path::new(&mdir).into()
37+
} else {
38+
std::env::current_dir()?
39+
};
3640
let repo = Repository::discover(&repo_path)?;
3741
let head = repo.head()?;
3842
let commit = head.peel_to_commit()?;

0 commit comments

Comments
 (0)