Skip to content

Commit

Permalink
feat: automatically enforce strict mode if -c options are given on …
Browse files Browse the repository at this point in the history
…the command-line.

This should stop most mistakes right away, instead of possibly silently
ignoring them depending on what was hard-coded in the respective sub-command.
  • Loading branch information
Byron committed Oct 18, 2023
1 parent b230078 commit f9ae1bc
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plumbing/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,15 @@ pub fn main() -> Result<()> {

let repository = {
let config = config.clone();
move |mode: Mode| -> Result<gix::Repository> {
move |mut mode: Mode| -> Result<gix::Repository> {
let mut mapping: gix::sec::trust::Mapping<gix::open::Options> = Default::default();
if !config.is_empty() {
mode = match mode {
Mode::Lenient => Mode::Strict,
Mode::LenientWithGitInstallConfig => Mode::StrictWithGitInstallConfig,
_ => mode,
};
}
let strict_toggle = matches!(mode, Mode::Strict | Mode::StrictWithGitInstallConfig) || args.strict;
mapping.full = mapping.full.strict_config(strict_toggle);
mapping.reduced = mapping.reduced.strict_config(strict_toggle);
Expand Down

0 comments on commit f9ae1bc

Please sign in to comment.