Skip to content

Commit ac7db94

Browse files
committed
feat: add --strict option to enforce strict checking of configuration.
1 parent 17d93a0 commit ac7db94

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/plumbing/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn main() -> Result<()> {
7171
let config = config.clone();
7272
move |mode: Mode| -> Result<git::Repository> {
7373
let mut mapping: git::sec::trust::Mapping<git::open::Options> = Default::default();
74-
let strict_toggle = matches!(mode, Mode::Strict | Mode::StrictWithGitInstallConfig);
74+
let strict_toggle = matches!(mode, Mode::Strict | Mode::StrictWithGitInstallConfig) || args.strict;
7575
mapping.full = mapping.full.strict_config(strict_toggle);
7676
mapping.reduced = mapping.reduced.strict_config(strict_toggle);
7777
let git_installation = matches!(

src/plumbing/options/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ pub struct Args {
3535
#[clap(long, conflicts_with("verbose"))]
3636
pub progress: bool,
3737

38+
/// Don't default malformed configuration flags, but show an error instead.
39+
///
40+
/// Note that some subcommands use strict mode by default.
41+
// TODO: needs a 'lenient' mutually exclusive counterpart. Opens the gate to auto-verbose some commands, and add --no-verbose
42+
// for these.
43+
#[clap(long, short = 's')]
44+
pub strict: bool,
45+
3846
/// The progress TUI will stay up even though the work is already completed.
3947
///
4048
/// Use this to be able to read progress messages or additional information visible in the TUI log pane.

0 commit comments

Comments
 (0)