That way, it's usable for learning everything about credentials for example.
Unified · Split
| @@ -17,31 +17,35 @@ use crate::{ · 16 unmodified lines | |||
| 17 | impl File<'static> { | 17 | impl File<'static> { |
| 18 | /// Open all global configuration files which involves the following sources: | 18 | /// Open all global configuration files which involves the following sources: |
| 19 | /// | 19 | /// |
| 20 | /// * [system][crate::Source::System] | 20 | /// * [git-installation](source::Kind::GitInstallation) |
| 21 | /// * [git][crate::Source::Git] | 21 | /// * [system](source::Kind::System) |
| 22 | /// * [user][crate::Source::User] | 22 | /// * [globals](source::Kind::Global) |
| 23 | /// | 23 | /// |
| 24 | /// which excludes repository local configuration, as well as override-configuration from environment variables. | 24 | /// which excludes repository local configuration, as well as override-configuration from environment variables. |
| 25 | /// | 25 | /// |
| 26 | /// Note that the file might [be empty][File::is_void()] in case no configuration file was found. | 26 | /// Note that the file might [be empty][File::is_void()] in case no configuration file was found. |
| 27 | pub fn from_globals() -> Result<File<'static>, init::from_paths::Error> { | 27 | pub fn from_globals() -> Result<File<'static>, init::from_paths::Error> { |
| 28 | let metas = [source::Kind::System, source::Kind::Global] | 28 | let metas = [ |
| 29 | .iter() | 29 | source::Kind::GitInstallation, |
| 30 | .flat_map(|kind| kind.sources()) | 30 | source::Kind::System, |
| 31 | .filter_map(|source| { | 31 | source::Kind::Global, |
| 32 | let path = source | 32 | ] |
| 33 | .storage_location(&mut gix_path::env::var) | 33 | .iter() |
| 34 | .and_then(|p| p.is_file().then_some(p)) | 34 | .flat_map(|kind| kind.sources()) |
| 35 | .map(Cow::into_owned); | 35 | .filter_map(|source| { |
| 36 | let path = source | ||
| 37 | .storage_location(&mut gix_path::env::var) | ||
| 38 | .and_then(|p| p.is_file().then_some(p)) | ||
| 39 | .map(Cow::into_owned); | ||
| 36 | 40 | ||
| 37 | Metadata { | 41 | Metadata { |
| 38 | path, | 42 | path, |
| 39 | source: *source, | 43 | source: *source, |
| 40 | level: 0, | 44 | level: 0, |
| 41 | trust: gix_sec::Trust::Full, | 45 | trust: gix_sec::Trust::Full, |
| 42 | } | 46 | } |
| 43 | .into() | 47 | .into() |
| 44 | }); | 48 | }); |
| 45 | 49 | ||
| 46 | let home = gix_path::env::home_dir(); | 50 | let home = gix_path::env::home_dir(); |
| 47 | let options = init::Options { | 51 | let options = init::Options { |