refactor!: use named arguments if there is more than one

This commit is contained in:
Aleksey Kulikov 2021-09-30 18:04:36 +03:00
parent ec80ad3dd4
commit 5f7fdf4bd3
66 changed files with 1920 additions and 1136 deletions

View file

@ -12,10 +12,13 @@ import '../util.dart';
/// The reflog must be freed manually.
///
/// Throws a [LibGit2Error] if error occured.
Pointer<git_reflog> read(Pointer<git_repository> repo, String name) {
Pointer<git_reflog> read({
required Pointer<git_repository> repoPointer,
required String name,
}) {
final out = calloc<Pointer<git_reflog>>();
final nameC = name.toNativeUtf8().cast<Int8>();
final error = libgit2.git_reflog_read(out, repo, nameC);
final error = libgit2.git_reflog_read(out, repoPointer, nameC);
calloc.free(nameC);
@ -34,8 +37,11 @@ int entryCount(Pointer<git_reflog> reflog) =>
///
/// Requesting the reflog entry with an index of 0 (zero) will return
/// the most recently created entry.
Pointer<git_reflog_entry> getByIndex(Pointer<git_reflog> reflog, int idx) {
return libgit2.git_reflog_entry_byindex(reflog, idx);
Pointer<git_reflog_entry> getByIndex({
required Pointer<git_reflog> reflogPointer,
required int index,
}) {
return libgit2.git_reflog_entry_byindex(reflogPointer, index);
}
/// Get the log message.