mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(annotated)!: add more bindings and API methods (#26)
This commit is contained in:
parent
0176b66ba7
commit
fe570a6990
13 changed files with 498 additions and 146 deletions
|
@ -15,44 +15,23 @@ class Rebase {
|
|||
/// reachable commits.
|
||||
///
|
||||
/// [onto] is the branch to rebase onto, default is to rebase onto the given
|
||||
/// [upstream] (throws if [upstream] is not provided).
|
||||
/// [upstream].
|
||||
///
|
||||
/// **IMPORTANT**: Should be freed to release allocated memory.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Rebase.init({
|
||||
required Repository repo,
|
||||
Oid? branch,
|
||||
Oid? upstream,
|
||||
Oid? onto,
|
||||
AnnotatedCommit? branch,
|
||||
AnnotatedCommit? upstream,
|
||||
AnnotatedCommit? onto,
|
||||
}) {
|
||||
AnnotatedCommit? _branch, _upstream, _onto;
|
||||
if (branch != null) {
|
||||
_branch = AnnotatedCommit.lookup(repo: repo, oid: branch);
|
||||
}
|
||||
if (upstream != null) {
|
||||
_upstream = AnnotatedCommit.lookup(repo: repo, oid: upstream);
|
||||
}
|
||||
if (onto != null) {
|
||||
_onto = AnnotatedCommit.lookup(repo: repo, oid: onto);
|
||||
}
|
||||
|
||||
_rebasePointer = bindings.init(
|
||||
repoPointer: repo.pointer,
|
||||
branchPointer: _branch?.pointer.value,
|
||||
upstreamPointer: _upstream?.pointer.value,
|
||||
ontoPointer: _onto?.pointer.value,
|
||||
branchPointer: branch?.pointer,
|
||||
upstreamPointer: upstream?.pointer,
|
||||
ontoPointer: onto?.pointer,
|
||||
);
|
||||
|
||||
if (branch != null) {
|
||||
_branch!.free();
|
||||
}
|
||||
if (upstream != null) {
|
||||
_upstream!.free();
|
||||
}
|
||||
if (onto != null) {
|
||||
_onto!.free();
|
||||
}
|
||||
}
|
||||
|
||||
/// Pointer to memory address for allocated rebase object.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue