mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 12:49:08 -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
|
@ -89,17 +89,20 @@ Pointer<git_oid> mergeBaseOctopus({
|
|||
List<int> analysis({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
required Pointer<git_reference> ourRefPointer,
|
||||
required Pointer<Pointer<git_annotated_commit>> theirHeadPointer,
|
||||
required Pointer<git_annotated_commit> theirHeadPointer,
|
||||
required int theirHeadsLen,
|
||||
}) {
|
||||
final analysisOut = calloc<Int32>();
|
||||
final preferenceOut = calloc<Int32>();
|
||||
final theirHead = calloc<Pointer<git_annotated_commit>>();
|
||||
theirHead[0] = theirHeadPointer;
|
||||
|
||||
libgit2.git_merge_analysis_for_ref(
|
||||
analysisOut,
|
||||
preferenceOut,
|
||||
repoPointer,
|
||||
ourRefPointer,
|
||||
theirHeadPointer,
|
||||
theirHead,
|
||||
theirHeadsLen,
|
||||
);
|
||||
|
||||
|
@ -107,6 +110,7 @@ List<int> analysis({
|
|||
|
||||
calloc.free(analysisOut);
|
||||
calloc.free(preferenceOut);
|
||||
calloc.free(theirHead);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -117,12 +121,15 @@ List<int> analysis({
|
|||
/// completes, resolve any conflicts and prepare a commit.
|
||||
void merge({
|
||||
required Pointer<git_repository> repoPointer,
|
||||
required Pointer<Pointer<git_annotated_commit>> theirHeadsPointer,
|
||||
required Pointer<git_annotated_commit> theirHeadPointer,
|
||||
required int theirHeadsLen,
|
||||
required int favor,
|
||||
required int mergeFlags,
|
||||
required int fileFlags,
|
||||
}) {
|
||||
final theirHead = calloc<Pointer<git_annotated_commit>>();
|
||||
theirHead[0] = theirHeadPointer;
|
||||
|
||||
final mergeOpts = _initMergeOptions(
|
||||
favor: favor,
|
||||
mergeFlags: mergeFlags,
|
||||
|
@ -138,7 +145,7 @@ void merge({
|
|||
|
||||
libgit2.git_merge(
|
||||
repoPointer,
|
||||
theirHeadsPointer,
|
||||
theirHead,
|
||||
theirHeadsLen,
|
||||
mergeOpts,
|
||||
checkoutOpts,
|
||||
|
@ -146,6 +153,7 @@ void merge({
|
|||
|
||||
calloc.free(mergeOpts);
|
||||
calloc.free(checkoutOpts);
|
||||
calloc.free(theirHead);
|
||||
}
|
||||
|
||||
/// Merge two files as they exist in the in-memory data structures, using the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue