feat(reset): add ability to remove entries in index (#57)

This commit is contained in:
Aleksey Kulikov 2022-05-18 15:49:08 +03:00 committed by GitHub
parent 16c42b9b2d
commit faddaa52e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 9 deletions

View file

@ -28,12 +28,15 @@ void reset({
/// Updates some entries in the index from the target commit tree.
///
/// The scope of the updated entries is determined by the paths being passed in
/// the pathspec parameters.
/// the [pathspec] parameters.
///
/// Passing a null [targetPointer] will result in removing entries in the index
/// matching the provided [pathspec]s.
///
/// Throws a [LibGit2Error] if error occured.
void resetDefault({
required Pointer<git_repository> repoPointer,
required Pointer<git_object> targetPointer,
required Pointer<git_object>? targetPointer,
required List<String> pathspec,
}) {
final pathspecC = calloc<git_strarray>();
@ -50,7 +53,7 @@ void resetDefault({
final error = libgit2.git_reset_default(
repoPointer,
targetPointer,
targetPointer ?? nullptr,
pathspecC,
);