@@ -149,6 +149,8 @@ impl Config {
149
149
150
150
/// Remove multivar config variables in the config file with the highest level (usually the
151
151
/// local one).
152
+ ///
153
+ /// The regular expression is applied case-sensitively on the value.
152
154
pub fn remove_multivar ( & mut self , name : & str , regexp : & str ) -> Result < ( ) , Error > {
153
155
let name = CString :: new ( name) ?;
154
156
let regexp = CString :: new ( regexp) ?;
@@ -204,6 +206,8 @@ impl Config {
204
206
///
205
207
/// This is the same as `get_bytes` except that it may return `Err` if
206
208
/// the bytes are not valid utf-8.
209
+ ///
210
+ /// This method will return an error if this `Config` is not a snapshot.
207
211
pub fn get_str ( & self , name : & str ) -> Result < & str , Error > {
208
212
str:: from_utf8 ( self . get_bytes ( name) ?)
209
213
. map_err ( |_| Error :: from_str ( "configuration value is not valid utf8" ) )
@@ -223,6 +227,10 @@ impl Config {
223
227
224
228
/// Get the value of a string config variable as an owned string.
225
229
///
230
+ /// All config files will be looked into, in the order of their
231
+ /// defined level. A higher level means a higher priority. The
232
+ /// first occurrence of the variable will be returned here.
233
+ ///
226
234
/// An error will be returned if the config value is not valid utf-8.
227
235
pub fn get_string ( & self , name : & str ) -> Result < String , Error > {
228
236
let ret = Buf :: new ( ) ;
@@ -235,7 +243,15 @@ impl Config {
235
243
. map_err ( |_| Error :: from_str ( "configuration value is not valid utf8" ) )
236
244
}
237
245
238
- /// Get the value of a path config variable as an owned .
246
+ /// Get the value of a path config variable as an owned `PathBuf`.
247
+ ///
248
+ /// A leading '~' will be expanded to the global search path (which
249
+ /// defaults to the user's home directory but can be overridden via
250
+ /// [`raw::git_libgit2_opts`].
251
+ ///
252
+ /// All config files will be looked into, in the order of their
253
+ /// defined level. A higher level means a higher priority. The
254
+ /// first occurrence of the variable will be returned here.
239
255
pub fn get_path ( & self , name : & str ) -> Result < PathBuf , Error > {
240
256
let ret = Buf :: new ( ) ;
241
257
let name = CString :: new ( name) ?;
@@ -260,6 +276,10 @@ impl Config {
260
276
/// If `glob` is `Some`, then the iterator will only iterate over all
261
277
/// variables whose name matches the pattern.
262
278
///
279
+ /// The regular expression is applied case-sensitively on the normalized form of
280
+ /// the variable name: the section and variable parts are lower-cased. The
281
+ /// subsection is left unchanged.
282
+ ///
263
283
/// # Example
264
284
///
265
285
/// ```
@@ -293,6 +313,10 @@ impl Config {
293
313
///
294
314
/// If `regexp` is `Some`, then the iterator will only iterate over all
295
315
/// values which match the pattern.
316
+ ///
317
+ /// The regular expression is applied case-sensitively on the normalized form of
318
+ /// the variable name: the section and variable parts are lower-cased. The
319
+ /// subsection is left unchanged.
296
320
pub fn multivar ( & self , name : & str , regexp : Option < & str > ) -> Result < ConfigEntries < ' _ > , Error > {
297
321
let mut ret = ptr:: null_mut ( ) ;
298
322
let name = CString :: new ( name) ?;
@@ -363,6 +387,8 @@ impl Config {
363
387
364
388
/// Set the value of an multivar config variable in the config file with the
365
389
/// highest level (usually the local one).
390
+ ///
391
+ /// The regular expression is applied case-sensitively on the value.
366
392
pub fn set_multivar ( & mut self , name : & str , regexp : & str , value : & str ) -> Result < ( ) , Error > {
367
393
let name = CString :: new ( name) ?;
368
394
let regexp = CString :: new ( regexp) ?;
@@ -398,6 +424,7 @@ impl Config {
398
424
}
399
425
400
426
/// Parse a string as a bool.
427
+ ///
401
428
/// Interprets "true", "yes", "on", 1, or any non-zero number as true.
402
429
/// Interprets "false", "no", "off", 0, or an empty string as false.
403
430
pub fn parse_bool < S : IntoCString > ( s : S ) -> Result < bool , Error > {
0 commit comments