mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(revparse): add bindings and api
This commit is contained in:
parent
3b13646b1b
commit
ce9384cac9
8 changed files with 372 additions and 57 deletions
23
lib/src/bindings/merge.dart
Normal file
23
lib/src/bindings/merge.dart
Normal file
|
@ -0,0 +1,23 @@
|
|||
import 'dart:ffi';
|
||||
import 'package:ffi/ffi.dart';
|
||||
import '../error.dart';
|
||||
import 'libgit2_bindings.dart';
|
||||
import '../util.dart';
|
||||
|
||||
/// Find a merge base between two commits.
|
||||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_oid> mergeBase(
|
||||
Pointer<git_repository> repo,
|
||||
Pointer<git_oid> one,
|
||||
Pointer<git_oid> two,
|
||||
) {
|
||||
final out = calloc<git_oid>();
|
||||
final error = libgit2.git_merge_base(out, repo, one, two);
|
||||
|
||||
if (error < 0) {
|
||||
throw LibGit2Error(libgit2.git_error_last());
|
||||
} else {
|
||||
return out;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue