mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 12:49:08 -04:00
feat(config): add ability to delete multivar
This commit is contained in:
parent
dadd235b66
commit
36f874c4a6
3 changed files with 63 additions and 5 deletions
|
@ -251,7 +251,7 @@ List<String> getMultivarValue(
|
|||
/// Set the value of a multivar config variable in the config file with the
|
||||
/// highest level (usually the local one).
|
||||
///
|
||||
/// The regular expression is applied case-sensitively on the value.
|
||||
/// The regexp is applied case-sensitively on the value.
|
||||
void setMultivarValue(
|
||||
Pointer<git_config> cfg,
|
||||
String variable,
|
||||
|
@ -267,3 +267,20 @@ void setMultivarValue(
|
|||
calloc.free(regexpC);
|
||||
calloc.free(valueC);
|
||||
}
|
||||
|
||||
/// Deletes one or several values from a multivar in the config file
|
||||
/// with the highest level (usually the local one).
|
||||
///
|
||||
/// The regexp is applied case-sensitively on the value.
|
||||
void deleteMultivar(
|
||||
Pointer<git_config> cfg,
|
||||
String variable,
|
||||
String regexp,
|
||||
) {
|
||||
final name = variable.toNativeUtf8().cast<Int8>();
|
||||
final regexpC = regexp.toNativeUtf8().cast<Int8>();
|
||||
libgit2.git_config_delete_multivar(cfg, name, regexpC);
|
||||
|
||||
calloc.free(name);
|
||||
calloc.free(regexpC);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue