File tree 2 files changed +7
-8
lines changed
2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -234,10 +234,6 @@ mod config {
234
234
pub mod open {
235
235
pub type Error = git_config:: parser:: ParserOrIoError < ' static > ;
236
236
}
237
- ///
238
- pub mod query {
239
- pub type Error = git_config:: file:: GitConfigError < ' static > ;
240
- }
241
237
}
242
238
243
239
///
Original file line number Diff line number Diff line change 1
- use crate :: config;
2
-
3
1
/// Provide simplified access to git configuration values
4
2
impl crate :: Repository {
5
3
/// Return the integer value at `key` (like `core.abbrev`) or use the given `default` value if it isn't present.
6
- pub fn config_int ( _key : & str , _default : i64 ) -> Result < i64 , config:: query:: Error > {
7
- todo ! ( )
4
+ // TODO: figure out how to identify sub-sections, or how to design such an API. This is really just a first test.
5
+ // TODO: tests
6
+ pub fn config_int ( & self , key : & str , default : i64 ) -> i64 {
7
+ let ( section, key) = key. split_once ( '.' ) . expect ( "valid section.key format" ) ;
8
+ self . config
9
+ . value :: < git_config:: values:: Integer > ( section, None , key)
10
+ . map_or ( default, |v| v. value )
8
11
}
9
12
}
You can’t perform that action at this time.
0 commit comments