History

feat: automatically enforce strict mode if `-c` options are given on 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.

Sebastian Thiel committed 3 years ago

Commit f9ae1bc1 parent b2300781 file · +8 −1Browse files

Showing the changes to src (1 of 1 file). Show all

Unified · Split

src/plumbing/main.rs+8−1
@@ -83,8 +83,15 @@ pub fn main() -> Result<()> { · 82 unmodified lines
83 83
84 let repository = {84 let repository = {
85 let config = config.clone();85 let config = config.clone();
86 move |mode: Mode| -> Result<gix::Repository> {86 move |mut mode: Mode| -> Result<gix::Repository> {
87 let mut mapping: gix::sec::trust::Mapping<gix::open::Options> = Default::default();87 let mut mapping: gix::sec::trust::Mapping<gix::open::Options> = Default::default();
88 if !config.is_empty() {
89 mode = match mode {
90 Mode::Lenient => Mode::Strict,
91 Mode::LenientWithGitInstallConfig => Mode::StrictWithGitInstallConfig,
92 _ => mode,
93 };
94 }
88 let strict_toggle = matches!(mode, Mode::Strict | Mode::StrictWithGitInstallConfig) || args.strict;95 let strict_toggle = matches!(mode, Mode::Strict | Mode::StrictWithGitInstallConfig) || args.strict;
89 mapping.full = mapping.full.strict_config(strict_toggle);96 mapping.full = mapping.full.strict_config(strict_toggle);
90 mapping.reduced = mapping.reduced.strict_config(strict_toggle);97 mapping.reduced = mapping.reduced.strict_config(strict_toggle);