mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(config): add ability to delete variable
This commit is contained in:
parent
2cdcccefc9
commit
4988b295a5
3 changed files with 40 additions and 3 deletions
|
@ -233,11 +233,22 @@ Map<String, dynamic> getVariables(Pointer<git_config> cfg) {
|
|||
return entries;
|
||||
}
|
||||
|
||||
/// Delete a config variable from the config file with the highest level
|
||||
/// (usually the local one).
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
void deleteVariable(Pointer<git_config> cfg, String name) {
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final error = libgit2.git_config_delete_entry(cfg, nameC);
|
||||
calloc.free(nameC);
|
||||
|
||||
if (error < 0) {
|
||||
throw LibGit2Error(libgit2.git_error_last());
|
||||
}
|
||||
}
|
||||
|
||||
/// Iterate over the values of multivar
|
||||
// TODO
|
||||
|
||||
/// Multivars variables get/set
|
||||
// TODO
|
||||
|
||||
/// Deletes a config variable
|
||||
// TODO
|
Loading…
Add table
Add a link
Reference in a new issue