History

fix: `File::from_globals()` now also provides options of the Git installation.

That way, it's usable for learning everything about credentials for example.

Sebastian Thiel committed 2 years ago

Commit a9a35451 parent 0c5d1ff1 file · +23 −19Browse files

Unified · Split

gix-config/src/file/init/comfort.rs+23−19
@@ -17,31 +17,35 @@ use crate::{ · 16 unmodified lines
1717 impl File<'static> {
1818 /// Open all global configuration files which involves the following sources:
1919 ///
20− /// * [system][crate::Source::System]
21− /// * [git][crate::Source::Git]
22− /// * [user][crate::Source::User]
20+ /// * [git-installation](source::Kind::GitInstallation)
21+ /// * [system](source::Kind::System)
22+ /// * [globals](source::Kind::Global)
2323 ///
2424 /// which excludes repository local configuration, as well as override-configuration from environment variables.
2525 ///
2626 /// Note that the file might [be empty][File::is_void()] in case no configuration file was found.
2727 pub fn from_globals() -> Result<File<'static>, init::from_paths::Error> {
28− let metas = [source::Kind::System, source::Kind::Global]
29− .iter()
30− .flat_map(|kind| kind.sources())
31− .filter_map(|source| {
32− let path = source
33− .storage_location(&mut gix_path::env::var)
34− .and_then(|p| p.is_file().then_some(p))
35− .map(Cow::into_owned);
28+ let metas = [
29+ source::Kind::GitInstallation,
30+ source::Kind::System,
31+ source::Kind::Global,
32+ ]
33+ .iter()
34+ .flat_map(|kind| kind.sources())
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);
3640
37− Metadata {
38− path,
39− source: *source,
40− level: 0,
41− trust: gix_sec::Trust::Full,
42− }
43− .into()
44− });
41+ Metadata {
42+ path,
43+ source: *source,
44+ level: 0,
45+ trust: gix_sec::Trust::Full,
46+ }
47+ .into()
48+ });
4549
4650 let home = gix_path::env::home_dir();
4751 let options = init::Options {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t