@@ -132,6 +132,24 @@ pub use schema::*;
132132
133133use super :: auth:: RegistryConfig ;
134134
135+ /// List of which configuration lists cannot be merged.
136+ ///
137+ /// Instead of merging,
138+ /// the higher priority list should replaces the lower priority list.
139+ ///
140+ /// ## What kind of config is non-mergeable
141+ ///
142+ /// The rule of thumb is that if a config is a path of a program,
143+ /// it should be added to this list.
144+ const NON_MERGEABLE_LISTS : & [ & str ] = & [
145+ "credential-alias.*" ,
146+ "doc.browser" ,
147+ "host.runner" ,
148+ "registries.*.credential-provider" ,
149+ "registry.credential-provider" ,
150+ "target.*.runner" ,
151+ ] ;
152+
135153/// Helper macro for creating typed access methods.
136154macro_rules! get_value_typed {
137155 ( $name: ident, $ty: ty, $variant: ident, $expected: expr) => {
@@ -2356,15 +2374,8 @@ impl ConfigValue {
23562374 }
23572375}
23582376
2359- /// List of which configuration lists cannot be merged.
2360- /// Instead of merging, these the higher priority list replaces the lower priority list.
23612377fn is_nonmergeable_list ( key : & ConfigKey ) -> bool {
2362- key. matches ( "registry.credential-provider" )
2363- || key. matches ( "registries.*.credential-provider" )
2364- || key. matches ( "target.*.runner" )
2365- || key. matches ( "host.runner" )
2366- || key. matches ( "credential-alias.*" )
2367- || key. matches ( "doc.browser" )
2378+ NON_MERGEABLE_LISTS . iter ( ) . any ( |l| key. matches ( l) )
23682379}
23692380
23702381pub fn homedir ( cwd : & Path ) -> Option < PathBuf > {
0 commit comments