@@ -60,7 +60,7 @@ impl ReplacementObjects {
60
60
}
61
61
62
62
/// The options used in [`ThreadSafeRepository::open_opts`]
63
- #[ derive( Default , Clone ) ]
63
+ #[ derive( Clone ) ]
64
64
pub struct Options {
65
65
pub ( crate ) object_store_slots : git_odb:: store:: init:: Slots ,
66
66
pub ( crate ) replacement_objects : ReplacementObjects ,
@@ -72,6 +72,21 @@ pub struct Options {
72
72
pub ( crate ) bail_if_untrusted : bool ,
73
73
}
74
74
75
+ impl Default for Options {
76
+ fn default ( ) -> Self {
77
+ Options {
78
+ object_store_slots : Default :: default ( ) ,
79
+ replacement_objects : Default :: default ( ) ,
80
+ permissions : Default :: default ( ) ,
81
+ git_dir_trust : None ,
82
+ filter_config_section : None ,
83
+ lossy_config : None ,
84
+ lenient_config : true ,
85
+ bail_if_untrusted : false ,
86
+ }
87
+ }
88
+ }
89
+
75
90
#[ derive( Default , Clone ) ]
76
91
#[ allow( dead_code) ]
77
92
pub ( crate ) struct EnvironmentOverrides {
@@ -182,13 +197,12 @@ impl Options {
182
197
self
183
198
}
184
199
185
- /// If set, default is false, invalid configuration values will be defaulted to acceptable values where when possible,
186
- /// instead of yielding an error during startup.
200
+ /// If set, default is false, invalid configuration values will cause an error even if these can safely be defaulted.
187
201
///
188
- /// This is recommended for all applications that prefer usability over correctness. `git` itslef by default is not lenient
189
- /// towards malconfigured repositories .
190
- pub fn lenient_config ( mut self , toggle : bool ) -> Self {
191
- self . lenient_config = toggle;
202
+ /// This is recommended for all applications that prefer correctness over usability.
203
+ /// `git` itself by defaults to strict configuration mode to let you know if configuration is incorrect .
204
+ pub fn strict_config ( mut self , toggle : bool ) -> Self {
205
+ self . lenient_config = ! toggle;
192
206
self
193
207
}
194
208
@@ -209,7 +223,7 @@ impl git_sec::trust::DefaultForLevel for Options {
209
223
filter_config_section : Some ( config:: section:: is_trusted) ,
210
224
lossy_config : None ,
211
225
bail_if_untrusted : false ,
212
- lenient_config : false ,
226
+ lenient_config : true ,
213
227
} ,
214
228
git_sec:: Trust :: Reduced => Options {
215
229
object_store_slots : git_odb:: store:: init:: Slots :: Given ( 32 ) , // limit resource usage
@@ -218,7 +232,7 @@ impl git_sec::trust::DefaultForLevel for Options {
218
232
git_dir_trust : git_sec:: Trust :: Reduced . into ( ) ,
219
233
filter_config_section : Some ( config:: section:: is_trusted) ,
220
234
bail_if_untrusted : false ,
221
- lenient_config : false ,
235
+ lenient_config : true ,
222
236
lossy_config : None ,
223
237
} ,
224
238
}
0 commit comments