mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
refactor(reference): simplify api
This commit is contained in:
parent
466f960c7b
commit
3c1a6b4ab4
6 changed files with 113 additions and 191 deletions
|
@ -41,7 +41,8 @@ class Branches {
|
|||
/// Throws a [LibGit2Error] if error occured.
|
||||
Branch operator [](String branchName) {
|
||||
final ref = Reference(
|
||||
_repoPointer, reference_bindings.lookupDWIM(_repoPointer, branchName));
|
||||
reference_bindings.lookupDWIM(_repoPointer, branchName),
|
||||
);
|
||||
late final GitBranch type;
|
||||
ref.isBranch ? type = GitBranch.local : GitBranch.remote;
|
||||
ref.free();
|
||||
|
@ -64,14 +65,12 @@ class Branches {
|
|||
required Commit target,
|
||||
bool force = false,
|
||||
}) {
|
||||
final result = bindings.create(
|
||||
return Reference(bindings.create(
|
||||
_repoPointer,
|
||||
name,
|
||||
target.pointer,
|
||||
force,
|
||||
);
|
||||
|
||||
return Reference(_repoPointer, result);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue