-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to use git executable for fetching advisory database #420
Allow to use git executable for fetching advisory database #420
Conversation
src/advisories/helpers.rs
Outdated
Allow, | ||
/// If this is true, then cargo deny will use the git executable to fetch advisory database. | ||
/// If this is false, then it uses a built-in git library. | ||
Allow(bool), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer if this was split into distinct variants, the reason the Fetch
is an enum is because I avoid bool
since it loses too much information, as shown by the need to comment what the bool
means in this case.
src/advisories/helpers.rs
Outdated
fs::create_dir_all(parent)?; | ||
} | ||
} else { | ||
return Err(anyhow!("invalid directory: {}", db_path.display())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return Err(anyhow!("invalid directory: {}", db_path.display())); | |
anyhow::bail!("invalid directory: {}", db_path.display()); |
src/advisories/helpers.rs
Outdated
|
||
if let Some(parent) = db_path.parent() { | ||
if !parent.is_dir() { | ||
fs::create_dir_all(parent)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fs::create_dir_all(parent)?; | |
fs::create_dir_all(parent).with_context(|| format!("failed to create advisory database directory {}", parent.display())?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thanks for the PR!
It uses its own escape hatch to force use of the CLI, much in the same way that Cargo does. This is critical for Windows. Ref: EmbarkStudios/cargo-deny#420
This PR allows the use of the git executable directly instead of using git2 (fetching advisory database only!). This is similar to what cargo does and solves #419 for me.
The option can be selected from deny.toml's advisories section