mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 12:19:09 -04:00
chore: upgrade dependencies (#58)
This commit is contained in:
parent
faddaa52e2
commit
3900ec92cc
48 changed files with 3453 additions and 3174 deletions
4
.github/workflows/master.yml
vendored
4
.github/workflows/master.yml
vendored
|
@ -19,7 +19,7 @@ jobs:
|
|||
- uses: actions/checkout@v3.0.1
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: master
|
||||
channel: stable
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
@ -47,7 +47,7 @@ jobs:
|
|||
- uses: actions/checkout@v3.0.1
|
||||
- uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: master
|
||||
channel: stable
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
|
|
@ -7,6 +7,7 @@ analyzer:
|
|||
|
||||
exclude:
|
||||
- lib/src/bindings/libgit2_bindings.dart
|
||||
- lib/src/bindings/libgit2_opts_bindings.dart
|
||||
|
||||
linter:
|
||||
rules:
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:args/command_runner.dart';
|
||||
import 'package:cli_util/cli_logging.dart' show Ansi, Logger;
|
||||
import 'package:libgit2dart/libgit2dart.dart';
|
||||
import 'package:libgit2dart/src/libgit2.dart';
|
||||
import 'package:libgit2dart/src/util.dart';
|
||||
|
@ -11,16 +10,13 @@ import 'package:pub_cache/pub_cache.dart';
|
|||
/// Copies prebuilt libgit2 library from package in '.pub_cache' into correct
|
||||
/// directory for [platform].
|
||||
Future<void> copyLibrary(String platform) async {
|
||||
final logger = Logger.standard();
|
||||
final ansi = Ansi(Ansi.terminalSupportsAnsi);
|
||||
|
||||
if (File(path.join(Directory.current.path, libDir, platform, getLibName()))
|
||||
.existsSync()) {
|
||||
if (libgit2Version == Libgit2.version) {
|
||||
logger.stdout('${ansi.green}libgit2 for $platform is already available.');
|
||||
stdout.writeln('libgit2 for $platform is already available.');
|
||||
} else {
|
||||
logger.stdout(
|
||||
'${ansi.red}libgit2 for $platform is outdated.\n'
|
||||
stdout.writeln(
|
||||
'libgit2 for $platform is outdated.\n'
|
||||
'Please run following commands: \n'
|
||||
'dart run libgit2dart:setup clean\n'
|
||||
'dart run libgit2dart:setup\n\n',
|
||||
|
@ -32,17 +28,14 @@ Future<void> copyLibrary(String platform) async {
|
|||
pubCache.getLatestVersion('libgit2dart')!.resolve()!.location;
|
||||
final libName = getLibName();
|
||||
|
||||
logger.stdout('Copying libgit2 for $platform');
|
||||
stdout.writeln('Copying libgit2 for $platform');
|
||||
final destination = path.join(libDir, platform);
|
||||
Directory(destination).createSync(recursive: true);
|
||||
File(path.join(pubCacheDir.path, platform, libName)).copySync(
|
||||
path.join(destination, libName),
|
||||
);
|
||||
|
||||
logger.stdout(
|
||||
'${ansi.green}Done! libgit2 for $platform is now available!'
|
||||
'${ansi.none}',
|
||||
);
|
||||
stdout.writeln('Done! libgit2 for $platform is now available!');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,8 +48,7 @@ class CleanCommand extends Command<void> {
|
|||
|
||||
@override
|
||||
void run() {
|
||||
final logger = Logger.standard();
|
||||
logger.stdout('Cleaning...');
|
||||
stdout.writeln('Cleaning...');
|
||||
Directory(libDir).deleteSync(recursive: true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/bash
|
||||
dart test --coverage="coverage" --test-randomize-ordering-seed random && format_coverage --lcov --check-ignore --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib && genhtml coverage/lcov.info -o coverage/ && dart pub global run flutter_coverage_badge
|
||||
dart test --coverage=coverage --test-randomize-ordering-seed random && dart pub global run coverage:format_coverage --lcov --check-ignore --in=coverage --out=coverage/lcov.info --report-on=lib && genhtml coverage/lcov.info -o coverage/ && dart pub global run flutter_coverage_badge
|
|
@ -76,7 +76,7 @@ Pointer<git_annotated_commit> fromRevSpec({
|
|||
required String revspec,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_annotated_commit>>();
|
||||
final revspecC = revspec.toNativeUtf8().cast<Int8>();
|
||||
final revspecC = revspec.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_annotated_commit_from_revspec(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -106,8 +106,8 @@ Pointer<git_annotated_commit> fromFetchHead({
|
|||
required Pointer<git_oid> oid,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_annotated_commit>>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Int8>();
|
||||
final remoteUrlC = remoteUrl.toNativeUtf8().cast<Int8>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Char>();
|
||||
final remoteUrlC = remoteUrl.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_annotated_commit_from_fetchhead(
|
||||
out,
|
||||
repoPointer,
|
||||
|
|
|
@ -14,9 +14,9 @@ Object? getAttribute({
|
|||
required String path,
|
||||
required String name,
|
||||
}) {
|
||||
final out = calloc<Pointer<Int8>>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final out = calloc<Pointer<Char>>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_attr_get(out, repoPointer, flags, pathC, nameC);
|
||||
|
||||
final result = out.value;
|
||||
|
|
|
@ -20,7 +20,7 @@ Pointer<git_blame> file({
|
|||
int? maxLine,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_blame>>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final options = calloc<git_blame_options>();
|
||||
libgit2.git_blame_options_init(options, GIT_BLAME_OPTIONS_VERSION);
|
||||
|
||||
|
@ -77,7 +77,7 @@ Pointer<git_blame> buffer({
|
|||
required String buffer,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_blame>>();
|
||||
final bufferC = buffer.toNativeUtf8().cast<Int8>();
|
||||
final bufferC = buffer.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_blame_buffer(
|
||||
out,
|
||||
reference,
|
||||
|
|
|
@ -84,7 +84,7 @@ Pointer<git_oid> createFromWorkdir({
|
|||
required String relativePath,
|
||||
}) {
|
||||
final out = calloc<git_oid>();
|
||||
final relativePathC = relativePath.toNativeUtf8().cast<Int8>();
|
||||
final relativePathC = relativePath.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_blob_create_from_workdir(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -110,7 +110,7 @@ Pointer<git_oid> createFromDisk({
|
|||
required String path,
|
||||
}) {
|
||||
final out = calloc<git_oid>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_blob_create_from_disk(out, repoPointer, pathC);
|
||||
|
||||
calloc.free(pathC);
|
||||
|
@ -150,7 +150,7 @@ String filterContent({
|
|||
git_oid? attributesCommit,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final asPathC = asPath.toNativeUtf8().cast<Int8>();
|
||||
final asPathC = asPath.toNativeUtf8().cast<Char>();
|
||||
final opts = calloc<git_blob_filter_options>();
|
||||
libgit2.git_blob_filter_options_init(opts, GIT_BLOB_FILTER_OPTIONS_VERSION);
|
||||
opts.ref.flags = flags;
|
||||
|
|
|
@ -60,7 +60,7 @@ Pointer<git_reference> lookup({
|
|||
required int branchType,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reference>>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Int8>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_branch_lookup(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -97,7 +97,7 @@ Pointer<git_reference> create({
|
|||
required bool force,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reference>>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Int8>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Char>();
|
||||
final forceC = force ? 1 : 0;
|
||||
final error = libgit2.git_branch_create(
|
||||
out,
|
||||
|
@ -147,7 +147,7 @@ void rename({
|
|||
required bool force,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reference>>();
|
||||
final newBranchNameC = newBranchName.toNativeUtf8().cast<Int8>();
|
||||
final newBranchNameC = newBranchName.toNativeUtf8().cast<Char>();
|
||||
final forceC = force ? 1 : 0;
|
||||
final error = libgit2.git_branch_move(
|
||||
out,
|
||||
|
@ -202,7 +202,7 @@ bool isCheckedOut(Pointer<git_reference> branch) {
|
|||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
String name(Pointer<git_reference> ref) {
|
||||
final out = calloc<Pointer<Int8>>();
|
||||
final out = calloc<Pointer<Char>>();
|
||||
final error = libgit2.git_branch_name(out, ref);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -229,7 +229,7 @@ String remoteName({
|
|||
required String branchName,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Int8>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_branch_remote_name(out, repoPointer, branchNameC);
|
||||
|
||||
final result = out.ref.ptr.cast<Utf8>().toDartString(length: out.ref.size);
|
||||
|
@ -281,7 +281,7 @@ void setUpstream({
|
|||
required Pointer<git_reference> branchPointer,
|
||||
required String? branchName,
|
||||
}) {
|
||||
final branchNameC = branchName?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final branchNameC = branchName?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final error = libgit2.git_branch_set_upstream(branchPointer, branchNameC);
|
||||
|
||||
calloc.free(branchNameC);
|
||||
|
@ -303,7 +303,7 @@ String upstreamName({
|
|||
required String branchName,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Int8>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_branch_upstream_name(out, repoPointer, branchNameC);
|
||||
|
||||
final result = out.ref.ptr.cast<Utf8>().toDartString(length: out.ref.size);
|
||||
|
@ -330,7 +330,7 @@ String upstreamRemote({
|
|||
required String branchName,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Int8>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_branch_upstream_remote(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -361,7 +361,7 @@ String upstreamMerge({
|
|||
required String branchName,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Int8>();
|
||||
final branchNameC = branchName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_branch_upstream_merge(
|
||||
out,
|
||||
repoPointer,
|
||||
|
|
|
@ -127,13 +127,13 @@ List<Object> initOptions({
|
|||
optsC.ref.checkout_strategy = strategy;
|
||||
|
||||
if (directory != null) {
|
||||
optsC.ref.target_directory = directory.toNativeUtf8().cast<Int8>();
|
||||
optsC.ref.target_directory = directory.toNativeUtf8().cast<Char>();
|
||||
}
|
||||
|
||||
var pathPointers = <Pointer<Int8>>[];
|
||||
Pointer<Pointer<Int8>> strArray = nullptr;
|
||||
var pathPointers = <Pointer<Char>>[];
|
||||
Pointer<Pointer<Char>> strArray = nullptr;
|
||||
if (paths != null) {
|
||||
pathPointers = paths.map((e) => e.toNativeUtf8().cast<Int8>()).toList();
|
||||
pathPointers = paths.map((e) => e.toNativeUtf8().cast<Char>()).toList();
|
||||
strArray = calloc(paths.length);
|
||||
for (var i = 0; i < paths.length; i++) {
|
||||
strArray[i] = pathPointers[i];
|
||||
|
|
|
@ -45,10 +45,10 @@ Pointer<git_oid> create({
|
|||
required List<Pointer<git_commit>> parents,
|
||||
}) {
|
||||
final out = calloc<git_oid>();
|
||||
final updateRefC = updateRef.toNativeUtf8().cast<Int8>();
|
||||
final updateRefC = updateRef.toNativeUtf8().cast<Char>();
|
||||
final messageEncodingC =
|
||||
messageEncoding?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final messageC = message.toNativeUtf8().cast<Int8>();
|
||||
messageEncoding?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final messageC = message.toNativeUtf8().cast<Char>();
|
||||
final parentsC = calloc<Pointer<git_commit>>(parentCount);
|
||||
|
||||
if (parents.isNotEmpty) {
|
||||
|
@ -103,10 +103,10 @@ String createBuffer({
|
|||
required List<Pointer<git_commit>> parents,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final updateRefC = updateRef.toNativeUtf8().cast<Int8>();
|
||||
final updateRefC = updateRef.toNativeUtf8().cast<Char>();
|
||||
final messageEncodingC =
|
||||
messageEncoding?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final messageC = message.toNativeUtf8().cast<Int8>();
|
||||
messageEncoding?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final messageC = message.toNativeUtf8().cast<Char>();
|
||||
final parentsC = calloc<Pointer<git_commit>>(parentCount);
|
||||
|
||||
if (parents.isNotEmpty) {
|
||||
|
@ -169,10 +169,10 @@ Pointer<git_oid> amend({
|
|||
required Pointer<git_tree>? treePointer,
|
||||
}) {
|
||||
final out = calloc<git_oid>();
|
||||
final updateRefC = updateRef?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final updateRefC = updateRef?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final messageEncodingC =
|
||||
messageEncoding?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final messageC = message?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
messageEncoding?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final messageC = message?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
|
||||
final error = libgit2.git_commit_amend(
|
||||
out,
|
||||
|
@ -261,7 +261,7 @@ String headerField({
|
|||
required String field,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final fieldC = field.toNativeUtf8().cast<Int8>();
|
||||
final fieldC = field.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_commit_header_field(out, commitPointer, fieldC);
|
||||
|
||||
final result = out.ref.ptr.cast<Utf8>().toDartString(length: out.ref.size);
|
||||
|
|
|
@ -11,7 +11,7 @@ import 'package:libgit2dart/src/util.dart';
|
|||
/// config must be freed with [free].
|
||||
Pointer<git_config> open(String path) {
|
||||
final out = calloc<Pointer<git_config>>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_config_open_ondisk(out, pathC);
|
||||
|
||||
calloc.free(pathC);
|
||||
|
@ -145,7 +145,7 @@ Pointer<git_config_entry> getEntry({
|
|||
required String variable,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_config_entry>>();
|
||||
final nameC = variable.toNativeUtf8().cast<Int8>();
|
||||
final nameC = variable.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_config_get_entry(out, configPointer, nameC);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -167,7 +167,7 @@ void setBool({
|
|||
required String variable,
|
||||
required bool value,
|
||||
}) {
|
||||
final nameC = variable.toNativeUtf8().cast<Int8>();
|
||||
final nameC = variable.toNativeUtf8().cast<Char>();
|
||||
final valueC = value ? 1 : 0;
|
||||
libgit2.git_config_set_bool(configPointer, nameC, valueC);
|
||||
calloc.free(nameC);
|
||||
|
@ -180,7 +180,7 @@ void setInt({
|
|||
required String variable,
|
||||
required int value,
|
||||
}) {
|
||||
final nameC = variable.toNativeUtf8().cast<Int8>();
|
||||
final nameC = variable.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_config_set_int64(configPointer, nameC, value);
|
||||
calloc.free(nameC);
|
||||
}
|
||||
|
@ -192,8 +192,8 @@ void setString({
|
|||
required String variable,
|
||||
required String value,
|
||||
}) {
|
||||
final nameC = variable.toNativeUtf8().cast<Int8>();
|
||||
final valueC = value.toNativeUtf8().cast<Int8>();
|
||||
final nameC = variable.toNativeUtf8().cast<Char>();
|
||||
final valueC = value.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_config_set_string(configPointer, nameC, valueC);
|
||||
calloc.free(nameC);
|
||||
calloc.free(valueC);
|
||||
|
@ -220,7 +220,7 @@ void delete({
|
|||
required Pointer<git_config> configPointer,
|
||||
required String variable,
|
||||
}) {
|
||||
final nameC = variable.toNativeUtf8().cast<Int8>();
|
||||
final nameC = variable.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_config_delete_entry(configPointer, nameC);
|
||||
|
||||
calloc.free(nameC);
|
||||
|
@ -243,8 +243,8 @@ List<String> multivarValues({
|
|||
required String variable,
|
||||
String? regexp,
|
||||
}) {
|
||||
final nameC = variable.toNativeUtf8().cast<Int8>();
|
||||
final regexpC = regexp?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final nameC = variable.toNativeUtf8().cast<Char>();
|
||||
final regexpC = regexp?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final iterator = calloc<Pointer<git_config_iterator>>();
|
||||
final entry = calloc<Pointer<git_config_entry>>();
|
||||
|
||||
|
@ -286,9 +286,9 @@ void setMultivar({
|
|||
required String regexp,
|
||||
required String value,
|
||||
}) {
|
||||
final nameC = variable.toNativeUtf8().cast<Int8>();
|
||||
final regexpC = regexp.toNativeUtf8().cast<Int8>();
|
||||
final valueC = value.toNativeUtf8().cast<Int8>();
|
||||
final nameC = variable.toNativeUtf8().cast<Char>();
|
||||
final regexpC = regexp.toNativeUtf8().cast<Char>();
|
||||
final valueC = value.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_config_set_multivar(configPointer, nameC, regexpC, valueC);
|
||||
|
||||
|
@ -306,8 +306,8 @@ void deleteMultivar({
|
|||
required String variable,
|
||||
required String regexp,
|
||||
}) {
|
||||
final nameC = variable.toNativeUtf8().cast<Int8>();
|
||||
final regexpC = regexp.toNativeUtf8().cast<Int8>();
|
||||
final nameC = variable.toNativeUtf8().cast<Char>();
|
||||
final regexpC = regexp.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_config_delete_multivar(configPointer, nameC, regexpC);
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ Pointer<git_credential> userPass({
|
|||
required String password,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_credential>>();
|
||||
final usernameC = username.toNativeUtf8().cast<Int8>();
|
||||
final passwordC = password.toNativeUtf8().cast<Int8>();
|
||||
final usernameC = username.toNativeUtf8().cast<Char>();
|
||||
final passwordC = password.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_credential_userpass_plaintext_new(out, usernameC, passwordC);
|
||||
|
||||
|
@ -32,10 +32,10 @@ Pointer<git_credential> sshKey({
|
|||
required String passPhrase,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_credential>>();
|
||||
final usernameC = username.toNativeUtf8().cast<Int8>();
|
||||
final publicKeyC = publicKey.toNativeUtf8().cast<Int8>();
|
||||
final privateKeyC = privateKey.toNativeUtf8().cast<Int8>();
|
||||
final passPhraseC = passPhrase.toNativeUtf8().cast<Int8>();
|
||||
final usernameC = username.toNativeUtf8().cast<Char>();
|
||||
final publicKeyC = publicKey.toNativeUtf8().cast<Char>();
|
||||
final privateKeyC = privateKey.toNativeUtf8().cast<Char>();
|
||||
final passPhraseC = passPhrase.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_credential_ssh_key_new(
|
||||
out,
|
||||
|
@ -59,7 +59,7 @@ Pointer<git_credential> sshKey({
|
|||
/// Create a new ssh key credential object used for querying an ssh-agent.
|
||||
Pointer<git_credential> sshKeyFromAgent(String username) {
|
||||
final out = calloc<Pointer<git_credential>>();
|
||||
final usernameC = username.toNativeUtf8().cast<Int8>();
|
||||
final usernameC = username.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_credential_ssh_key_from_agent(out, usernameC);
|
||||
|
||||
|
@ -79,10 +79,10 @@ Pointer<git_credential> sshKeyFromMemory({
|
|||
required String passPhrase,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_credential>>();
|
||||
final usernameC = username.toNativeUtf8().cast<Int8>();
|
||||
final publicKeyC = publicKey.toNativeUtf8().cast<Int8>();
|
||||
final privateKeyC = privateKey.toNativeUtf8().cast<Int8>();
|
||||
final passPhraseC = passPhrase.toNativeUtf8().cast<Int8>();
|
||||
final usernameC = username.toNativeUtf8().cast<Char>();
|
||||
final publicKeyC = publicKey.toNativeUtf8().cast<Char>();
|
||||
final privateKeyC = privateKey.toNativeUtf8().cast<Char>();
|
||||
final passPhraseC = passPhrase.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_credential_ssh_key_memory_new(
|
||||
out,
|
||||
|
|
|
@ -100,7 +100,7 @@ String format({
|
|||
opts.ref.always_use_long_format = alwaysUseLongFormat ? 1 : 0;
|
||||
}
|
||||
if (dirtySuffix != null) {
|
||||
opts.ref.dirty_suffix = dirtySuffix.toNativeUtf8().cast<Int8>();
|
||||
opts.ref.dirty_suffix = dirtySuffix.toNativeUtf8().cast<Char>();
|
||||
}
|
||||
|
||||
libgit2.git_describe_format(out, describeResultPointer, opts);
|
||||
|
@ -140,7 +140,7 @@ Pointer<git_describe_options> _initOpts({
|
|||
opts.ref.describe_strategy = describeStrategy;
|
||||
}
|
||||
if (pattern != null) {
|
||||
opts.ref.pattern = pattern.toNativeUtf8().cast<Int8>();
|
||||
opts.ref.pattern = pattern.toNativeUtf8().cast<Char>();
|
||||
}
|
||||
if (onlyFollowFirstParent != null) {
|
||||
opts.ref.only_follow_first_parent = onlyFollowFirstParent ? 1 : 0;
|
||||
|
|
|
@ -253,7 +253,7 @@ void merge({
|
|||
/// other types of patch files.
|
||||
Pointer<git_diff> parse(String content) {
|
||||
final out = calloc<Pointer<git_diff>>();
|
||||
final contentC = content.toNativeUtf8().cast<Int8>();
|
||||
final contentC = content.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_diff_from_buffer(out, contentC, content.length);
|
||||
|
||||
final result = out.value;
|
||||
|
|
|
@ -33,8 +33,8 @@ List<int> aheadBehind({
|
|||
required Pointer<git_oid> localPointer,
|
||||
required Pointer<git_oid> upstreamPointer,
|
||||
}) {
|
||||
final ahead = calloc<Uint64>();
|
||||
final behind = calloc<Uint64>();
|
||||
final ahead = calloc<Size>();
|
||||
final behind = calloc<Size>();
|
||||
|
||||
libgit2.git_graph_ahead_behind(
|
||||
ahead,
|
||||
|
|
|
@ -125,7 +125,7 @@ Pointer<git_oid> writeTreeTo({
|
|||
/// Find the first position of any entries which point to given path in the Git
|
||||
/// index.
|
||||
bool find({required Pointer<git_index> indexPointer, required String path}) {
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final result = libgit2.git_index_find(nullptr, indexPointer, pathC);
|
||||
|
||||
calloc.free(pathC);
|
||||
|
@ -164,7 +164,7 @@ Pointer<git_index_entry> getByPath({
|
|||
required String path,
|
||||
required int stage,
|
||||
}) {
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final result = libgit2.git_index_get_bypath(indexPointer, pathC, stage);
|
||||
|
||||
calloc.free(pathC);
|
||||
|
@ -231,7 +231,7 @@ void addByPath({
|
|||
required Pointer<git_index> indexPointer,
|
||||
required String path,
|
||||
}) {
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_index_add_bypath(indexPointer, pathC);
|
||||
|
||||
calloc.free(pathC);
|
||||
|
@ -294,8 +294,8 @@ void addAll({
|
|||
}) {
|
||||
final pathspecC = calloc<git_strarray>();
|
||||
final pathPointers =
|
||||
pathspec.map((e) => e.toNativeUtf8().cast<Int8>()).toList();
|
||||
final strArray = calloc<Pointer<Int8>>(pathspec.length);
|
||||
pathspec.map((e) => e.toNativeUtf8().cast<Char>()).toList();
|
||||
final strArray = calloc<Pointer<Char>>(pathspec.length);
|
||||
|
||||
for (var i = 0; i < pathspec.length; i++) {
|
||||
strArray[i] = pathPointers[i];
|
||||
|
@ -339,8 +339,8 @@ void updateAll({
|
|||
}) {
|
||||
final pathspecC = calloc<git_strarray>();
|
||||
final pathPointers =
|
||||
pathspec.map((e) => e.toNativeUtf8().cast<Int8>()).toList();
|
||||
final strArray = calloc<Pointer<Int8>>(pathspec.length);
|
||||
pathspec.map((e) => e.toNativeUtf8().cast<Char>()).toList();
|
||||
final strArray = calloc<Pointer<Char>>(pathspec.length);
|
||||
|
||||
for (var i = 0; i < pathspec.length; i++) {
|
||||
strArray[i] = pathPointers[i];
|
||||
|
@ -379,7 +379,7 @@ void remove({
|
|||
required String path,
|
||||
required int stage,
|
||||
}) {
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_index_remove(indexPointer, pathC, stage);
|
||||
|
||||
calloc.free(pathC);
|
||||
|
@ -395,7 +395,7 @@ void removeDirectory({
|
|||
required String dir,
|
||||
required int stage,
|
||||
}) {
|
||||
final dirC = dir.toNativeUtf8().cast<Int8>();
|
||||
final dirC = dir.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_index_remove_directory(indexPointer, dirC, stage);
|
||||
calloc.free(dirC);
|
||||
}
|
||||
|
@ -407,8 +407,8 @@ void removeAll({
|
|||
}) {
|
||||
final pathspecC = calloc<git_strarray>();
|
||||
final pathPointers =
|
||||
pathspec.map((e) => e.toNativeUtf8().cast<Int8>()).toList();
|
||||
final strArray = calloc<Pointer<Int8>>(pathspec.length);
|
||||
pathspec.map((e) => e.toNativeUtf8().cast<Char>()).toList();
|
||||
final strArray = calloc<Pointer<Char>>(pathspec.length);
|
||||
|
||||
for (var i = 0; i < pathspec.length; i++) {
|
||||
strArray[i] = pathPointers[i];
|
||||
|
@ -511,7 +511,7 @@ void conflictRemove({
|
|||
required Pointer<git_index> indexPointer,
|
||||
required String path,
|
||||
}) {
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_index_conflict_remove(indexPointer, pathC);
|
||||
|
||||
calloc.free(pathC);
|
||||
|
|
File diff suppressed because it is too large
Load diff
294
lib/src/bindings/libgit2_opts_bindings.dart
Normal file
294
lib/src/bindings/libgit2_opts_bindings.dart
Normal file
|
@ -0,0 +1,294 @@
|
|||
// coverage:ignore-file
|
||||
|
||||
import 'dart:ffi' as ffi;
|
||||
|
||||
/// Bindings to libgit2 global options
|
||||
class Libgit2Opts {
|
||||
/// Holds the symbol lookup function.
|
||||
final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
|
||||
_lookup;
|
||||
|
||||
/// The symbols are looked up in [dynamicLibrary].
|
||||
Libgit2Opts(ffi.DynamicLibrary dynamicLibrary)
|
||||
: _lookup = dynamicLibrary.lookup;
|
||||
|
||||
/// Set or query a library global option
|
||||
///
|
||||
/// Available options:
|
||||
///
|
||||
/// * opts(GIT_OPT_GET_MWINDOW_SIZE, size_t *):
|
||||
///
|
||||
/// > Get the maximum mmap window size
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_MWINDOW_SIZE, size_t):
|
||||
///
|
||||
/// > Set the maximum mmap window size
|
||||
///
|
||||
/// * opts(GIT_OPT_GET_MWINDOW_MAPPED_LIMIT, size_t *):
|
||||
///
|
||||
/// > Get the maximum memory that will be mapped in total by the library
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_MWINDOW_MAPPED_LIMIT, size_t):
|
||||
///
|
||||
/// > Set the maximum amount of memory that can be mapped at any time
|
||||
/// > by the library
|
||||
///
|
||||
/// * opts(GIT_OPT_GET_MWINDOW_FILE_LIMIT, size_t *):
|
||||
///
|
||||
/// > Get the maximum number of files that will be mapped at any time by the
|
||||
/// > library
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_MWINDOW_FILE_LIMIT, size_t):
|
||||
///
|
||||
/// > Set the maximum number of files that can be mapped at any time
|
||||
/// > by the library. The default (0) is unlimited.
|
||||
///
|
||||
/// * opts(GIT_OPT_GET_SEARCH_PATH, int level, git_buf *buf)
|
||||
///
|
||||
/// > Get the search path for a given level of config data. "level" must
|
||||
/// > be one of `GIT_CONFIG_LEVEL_SYSTEM`, `GIT_CONFIG_LEVEL_GLOBAL`,
|
||||
/// > `GIT_CONFIG_LEVEL_XDG`, or `GIT_CONFIG_LEVEL_PROGRAMDATA`.
|
||||
/// > The search path is written to the `out` buffer.
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_SEARCH_PATH, int level, const char *path)
|
||||
///
|
||||
/// > Set the search path for a level of config data. The search path
|
||||
/// > applied to shared attributes and ignore files, too.
|
||||
/// >
|
||||
/// > - `path` lists directories delimited by GIT_PATH_LIST_SEPARATOR.
|
||||
/// > Pass NULL to reset to the default (generally based on environment
|
||||
/// > variables). Use magic path `$PATH` to include the old value
|
||||
/// > of the path (if you want to prepend or append, for instance).
|
||||
/// >
|
||||
/// > - `level` must be `GIT_CONFIG_LEVEL_SYSTEM`,
|
||||
/// > `GIT_CONFIG_LEVEL_GLOBAL`, `GIT_CONFIG_LEVEL_XDG`, or
|
||||
/// > `GIT_CONFIG_LEVEL_PROGRAMDATA`.
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_CACHE_OBJECT_LIMIT, git_object_t type, size_t size)
|
||||
///
|
||||
/// > Set the maximum data size for the given type of object to be
|
||||
/// > considered eligible for caching in memory. Setting to value to
|
||||
/// > zero means that that type of object will not be cached.
|
||||
/// > Defaults to 0 for GIT_OBJECT_BLOB (i.e. won't cache blobs) and 4k
|
||||
/// > for GIT_OBJECT_COMMIT, GIT_OBJECT_TREE, and GIT_OBJECT_TAG.
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_CACHE_MAX_SIZE, ssize_t max_storage_bytes)
|
||||
///
|
||||
/// > Set the maximum total data size that will be cached in memory
|
||||
/// > across all repositories before libgit2 starts evicting objects
|
||||
/// > from the cache. This is a soft limit, in that the library might
|
||||
/// > briefly exceed it, but will start aggressively evicting objects
|
||||
/// > from cache when that happens. The default cache size is 256MB.
|
||||
///
|
||||
/// * opts(GIT_OPT_ENABLE_CACHING, int enabled)
|
||||
///
|
||||
/// > Enable or disable caching completely.
|
||||
/// >
|
||||
/// > Because caches are repository-specific, disabling the cache
|
||||
/// > cannot immediately clear all cached objects, but each cache will
|
||||
/// > be cleared on the next attempt to update anything in it.
|
||||
///
|
||||
/// * opts(GIT_OPT_GET_CACHED_MEMORY, ssize_t *current, ssize_t *allowed)
|
||||
///
|
||||
/// > Get the current bytes in cache and the maximum that would be
|
||||
/// > allowed in the cache.
|
||||
///
|
||||
/// * opts(GIT_OPT_GET_TEMPLATE_PATH, git_buf *out)
|
||||
///
|
||||
/// > Get the default template path.
|
||||
/// > The path is written to the `out` buffer.
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_TEMPLATE_PATH, const char *path)
|
||||
///
|
||||
/// > Set the default template path.
|
||||
/// >
|
||||
/// > - `path` directory of template.
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_SSL_CERT_LOCATIONS, const char *file, const char *path)
|
||||
///
|
||||
/// > Set the SSL certificate-authority locations.
|
||||
/// >
|
||||
/// > - `file` is the location of a file containing several
|
||||
/// > certificates concatenated together.
|
||||
/// > - `path` is the location of a directory holding several
|
||||
/// > certificates, one per file.
|
||||
/// >
|
||||
/// > Either parameter may be `NULL`, but not both.
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_USER_AGENT, const char *user_agent)
|
||||
///
|
||||
/// > Set the value of the User-Agent header. This value will be
|
||||
/// > appended to "git/1.0", for compatibility with other git clients.
|
||||
/// >
|
||||
/// > - `user_agent` is the value that will be delivered as the
|
||||
/// > User-Agent header on HTTP requests.
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_WINDOWS_SHAREMODE, unsigned long value)
|
||||
///
|
||||
/// > Set the share mode used when opening files on Windows.
|
||||
/// > For more information, see the documentation for CreateFile.
|
||||
/// > The default is: FILE_SHARE_READ | FILE_SHARE_WRITE. This is
|
||||
/// > ignored and unused on non-Windows platforms.
|
||||
///
|
||||
/// * opts(GIT_OPT_GET_WINDOWS_SHAREMODE, unsigned long *value)
|
||||
///
|
||||
/// > Get the share mode used when opening files on Windows.
|
||||
///
|
||||
/// * opts(GIT_OPT_ENABLE_STRICT_OBJECT_CREATION, int enabled)
|
||||
///
|
||||
/// > Enable strict input validation when creating new objects
|
||||
/// > to ensure that all inputs to the new objects are valid. For
|
||||
/// > example, when this is enabled, the parent(s) and tree inputs
|
||||
/// > will be validated when creating a new commit. This defaults
|
||||
/// > to enabled.
|
||||
///
|
||||
/// * opts(GIT_OPT_ENABLE_STRICT_SYMBOLIC_REF_CREATION, int enabled)
|
||||
///
|
||||
/// > Validate the target of a symbolic ref when creating it. For
|
||||
/// > example, `foobar` is not a valid ref, therefore `foobar` is
|
||||
/// > not a valid target for a symbolic ref by default, whereas
|
||||
/// > `refs/heads/foobar` is. Disabling this bypasses validation
|
||||
/// > so that an arbitrary strings such as `foobar` can be used
|
||||
/// > for a symbolic ref target. This defaults to enabled.
|
||||
///
|
||||
/// * opts(GIT_OPT_SET_SSL_CIPHERS, const char *ciphers)
|
||||
///
|
||||
/// > Set the SSL ciphers use for HTTPS connections.
|
||||
/// >
|
||||
/// > - `ciphers` is the list of ciphers that are eanbled.
|
||||
///
|
||||
/// * opts(GIT_OPT_GET_USER_AGENT, git_buf *out)
|
||||
///
|
||||
/// > Get the value of the User-Agent header.
|
||||
/// > The User-Agent is written to the `out` buffer.
|
||||
///
|
||||
/// * opts(GIT_OPT_ENABLE_OFS_DELTA, int enabled)
|
||||
///
|
||||
/// > Enable or disable the use of "offset deltas" when creating packfiles,
|
||||
/// > and the negotiation of them when talking to a remote server.
|
||||
/// > Offset deltas store a delta base location as an offset into the
|
||||
/// > packfile from the current location, which provides a shorter encoding
|
||||
/// > and thus smaller resultant packfiles.
|
||||
/// > Packfiles containing offset deltas can still be read.
|
||||
/// > This defaults to enabled.
|
||||
///
|
||||
/// * opts(GIT_OPT_ENABLE_FSYNC_GITDIR, int enabled)
|
||||
///
|
||||
/// > Enable synchronized writes of files in the gitdir using `fsync`
|
||||
/// > (or the platform equivalent) to ensure that new object data
|
||||
/// > is written to permanent storage, not simply cached. This
|
||||
/// > defaults to disabled.
|
||||
///
|
||||
/// opts(GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION, int enabled)
|
||||
///
|
||||
/// > Enable strict verification of object hashsums when reading
|
||||
/// > objects from disk. This may impact performance due to an
|
||||
/// > additional checksum calculation on each object. This defaults
|
||||
/// > to enabled.
|
||||
///
|
||||
/// opts(GIT_OPT_SET_ALLOCATOR, git_allocator *allocator)
|
||||
///
|
||||
/// > Set the memory allocator to a different memory allocator. This
|
||||
/// > allocator will then be used to make all memory allocations for
|
||||
/// > libgit2 operations. If the given `allocator` is NULL, then the
|
||||
/// > system default will be restored.
|
||||
///
|
||||
/// opts(GIT_OPT_ENABLE_UNSAVED_INDEX_SAFETY, int enabled)
|
||||
///
|
||||
/// > Ensure that there are no unsaved changes in the index before
|
||||
/// > beginning any operation that reloads the index from disk (eg,
|
||||
/// > checkout). If there are unsaved changes, the instruction will
|
||||
/// > fail. (Using the FORCE flag to checkout will still overwrite
|
||||
/// > these changes.)
|
||||
///
|
||||
/// opts(GIT_OPT_GET_PACK_MAX_OBJECTS, size_t *out)
|
||||
///
|
||||
/// > Get the maximum number of objects libgit2 will allow in a pack
|
||||
/// > file when downloading a pack file from a remote. This can be
|
||||
/// > used to limit maximum memory usage when fetching from an untrusted
|
||||
/// > remote.
|
||||
///
|
||||
/// opts(GIT_OPT_SET_PACK_MAX_OBJECTS, size_t objects)
|
||||
///
|
||||
/// > Set the maximum number of objects libgit2 will allow in a pack
|
||||
/// > file when downloading a pack file from a remote.
|
||||
///
|
||||
/// opts(GIT_OPT_DISABLE_PACK_KEEP_FILE_CHECKS, int enabled)
|
||||
/// > This will cause .keep file existence checks to be skipped when
|
||||
/// > accessing packfiles, which can help performance with remote filesystems.
|
||||
///
|
||||
/// opts(GIT_OPT_ENABLE_HTTP_EXPECT_CONTINUE, int enabled)
|
||||
/// > When connecting to a server using NTLM or Negotiate
|
||||
/// > authentication, use expect/continue when POSTing data.
|
||||
/// > This option is not available on Windows.
|
||||
///
|
||||
/// opts(GIT_OPT_SET_ODB_PACKED_PRIORITY, int priority)
|
||||
/// > Override the default priority of the packed ODB backend which
|
||||
/// > is added when default backends are assigned to a repository
|
||||
///
|
||||
/// opts(GIT_OPT_SET_ODB_LOOSE_PRIORITY, int priority)
|
||||
/// > Override the default priority of the loose ODB backend which
|
||||
/// > is added when default backends are assigned to a repository
|
||||
///
|
||||
/// opts(GIT_OPT_GET_EXTENSIONS, git_strarray *out)
|
||||
/// > Returns the list of git extensions that are supported. This
|
||||
/// > is the list of built-in extensions supported by libgit2 and
|
||||
/// > custom extensions that have been added with
|
||||
/// > `GIT_OPT_SET_EXTENSIONS`. Extensions that have been negated
|
||||
/// > will not be returned. The returned list should be released
|
||||
/// > with `git_strarray_dispose`.
|
||||
///
|
||||
/// opts(GIT_OPT_SET_EXTENSIONS, const char **extensions, size_t len)
|
||||
/// > Set that the given git extensions are supported by the caller.
|
||||
/// > Extensions supported by libgit2 may be negated by prefixing
|
||||
/// > them with a `!`. For example: setting extensions to
|
||||
/// > { "!noop", "newext" } indicates that the caller does not want
|
||||
/// > to support repositories with the `noop` extension but does want
|
||||
/// > to support repositories with the `newext` extension.
|
||||
///
|
||||
/// opts(GIT_OPT_GET_OWNER_VALIDATION, int *enabled)
|
||||
/// > Gets the owner validation setting for repository
|
||||
/// > directories.
|
||||
///
|
||||
/// opts(GIT_OPT_SET_OWNER_VALIDATION, int enabled)
|
||||
/// > Set that repository directories should be owned by the current
|
||||
/// > user. The default is to validate ownership.
|
||||
///
|
||||
/// @param option Option key
|
||||
/// @param ... value to set the option
|
||||
/// @return 0 on success, <0 on failure
|
||||
int git_libgit2_opts(
|
||||
int option,
|
||||
ffi.Pointer<ffi.Char> out,
|
||||
) {
|
||||
return _git_libgit2_opts(
|
||||
option,
|
||||
out,
|
||||
);
|
||||
}
|
||||
|
||||
late final _git_libgit2_optsPtr = _lookup<
|
||||
ffi.NativeFunction<ffi.Int Function(ffi.Int, ffi.Pointer<ffi.Char>)>>(
|
||||
'git_libgit2_opts');
|
||||
late final _git_libgit2_opts = _git_libgit2_optsPtr
|
||||
.asFunction<int Function(int, ffi.Pointer<ffi.Char>)>();
|
||||
|
||||
/// Set a library global option.
|
||||
///
|
||||
/// Look at [git_libgit2_opts]
|
||||
int git_libgit2_opts_set(
|
||||
int option,
|
||||
int value,
|
||||
) {
|
||||
return _git_libgit2_opts_set(
|
||||
option,
|
||||
value,
|
||||
);
|
||||
}
|
||||
|
||||
late final _git_libgit2_opts_setPtr =
|
||||
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Int, ffi.Int)>>(
|
||||
'git_libgit2_opts');
|
||||
late final _git_libgit2_opts_set =
|
||||
_git_libgit2_opts_setPtr.asFunction<int Function(int, int)>();
|
||||
}
|
|
@ -25,7 +25,7 @@ Pointer<git_mailmap> init() {
|
|||
/// returned mailmap must be freed with [free].
|
||||
Pointer<git_mailmap> fromBuffer(String buffer) {
|
||||
final out = calloc<Pointer<git_mailmap>>();
|
||||
final bufferC = buffer.toNativeUtf8().cast<Int8>();
|
||||
final bufferC = buffer.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_mailmap_from_buffer(out, bufferC, buffer.length);
|
||||
|
||||
|
@ -70,10 +70,10 @@ List<String> resolve({
|
|||
required String name,
|
||||
required String email,
|
||||
}) {
|
||||
final outRealName = calloc<Pointer<Int8>>();
|
||||
final outRealEmail = calloc<Pointer<Int8>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final emailC = email.toNativeUtf8().cast<Int8>();
|
||||
final outRealName = calloc<Pointer<Char>>();
|
||||
final outRealEmail = calloc<Pointer<Char>>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final emailC = email.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_mailmap_resolve(
|
||||
outRealName,
|
||||
outRealEmail,
|
||||
|
@ -119,10 +119,10 @@ void addEntry({
|
|||
String? replaceName,
|
||||
required String replaceEmail,
|
||||
}) {
|
||||
final realNameC = realName?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final realEmailC = realEmail?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final replaceNameC = replaceName?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final replaceEmailC = replaceEmail.toNativeUtf8().cast<Int8>();
|
||||
final realNameC = realName?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final realEmailC = realEmail?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final replaceNameC = replaceName?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final replaceEmailC = replaceEmail.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_mailmap_add_entry(
|
||||
mailmapPointer,
|
||||
|
|
|
@ -183,11 +183,11 @@ String mergeFile({
|
|||
libgit2.git_merge_file_input_init(ancestorC, GIT_MERGE_FILE_INPUT_VERSION);
|
||||
libgit2.git_merge_file_input_init(oursC, GIT_MERGE_FILE_INPUT_VERSION);
|
||||
libgit2.git_merge_file_input_init(theirsC, GIT_MERGE_FILE_INPUT_VERSION);
|
||||
ancestorC.ref.ptr = ancestor.toNativeUtf8().cast<Int8>();
|
||||
ancestorC.ref.ptr = ancestor.toNativeUtf8().cast<Char>();
|
||||
ancestorC.ref.size = ancestor.length;
|
||||
oursC.ref.ptr = ours.toNativeUtf8().cast<Int8>();
|
||||
oursC.ref.ptr = ours.toNativeUtf8().cast<Char>();
|
||||
oursC.ref.size = ours.length;
|
||||
theirsC.ref.ptr = theirs.toNativeUtf8().cast<Int8>();
|
||||
theirsC.ref.ptr = theirs.toNativeUtf8().cast<Char>();
|
||||
theirsC.ref.size = theirs.length;
|
||||
|
||||
final opts = calloc<git_merge_file_options>();
|
||||
|
@ -195,13 +195,13 @@ String mergeFile({
|
|||
opts.ref.favor = favor;
|
||||
opts.ref.flags = flags;
|
||||
if (ancestorLabel.isNotEmpty) {
|
||||
opts.ref.ancestor_label = ancestorLabel.toNativeUtf8().cast<Int8>();
|
||||
opts.ref.ancestor_label = ancestorLabel.toNativeUtf8().cast<Char>();
|
||||
}
|
||||
if (oursLabel.isNotEmpty) {
|
||||
opts.ref.our_label = oursLabel.toNativeUtf8().cast<Int8>();
|
||||
opts.ref.our_label = oursLabel.toNativeUtf8().cast<Char>();
|
||||
}
|
||||
if (theirsLabel.isNotEmpty) {
|
||||
opts.ref.their_label = theirsLabel.toNativeUtf8().cast<Int8>();
|
||||
opts.ref.their_label = theirsLabel.toNativeUtf8().cast<Char>();
|
||||
}
|
||||
|
||||
libgit2.git_merge_file(out, ancestorC, oursC, theirsC, opts);
|
||||
|
|
|
@ -10,7 +10,7 @@ import 'package:libgit2dart/src/util.dart';
|
|||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
List<Map<String, Pointer>> list(Pointer<git_repository> repo) {
|
||||
final notesRef = 'refs/notes/commits'.toNativeUtf8().cast<Int8>();
|
||||
final notesRef = 'refs/notes/commits'.toNativeUtf8().cast<Char>();
|
||||
final iterator = calloc<Pointer<git_iterator>>();
|
||||
final iteratorError = libgit2.git_note_iterator_new(iterator, repo, notesRef);
|
||||
|
||||
|
@ -57,7 +57,7 @@ Pointer<git_note> lookup({
|
|||
String notesRef = 'refs/notes/commits',
|
||||
}) {
|
||||
final out = calloc<Pointer<git_note>>();
|
||||
final notesRefC = notesRef.toNativeUtf8().cast<Int8>();
|
||||
final notesRefC = notesRef.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_note_read(out, repoPointer, notesRefC, oidPointer);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -85,8 +85,8 @@ Pointer<git_oid> create({
|
|||
bool force = false,
|
||||
}) {
|
||||
final out = calloc<git_oid>();
|
||||
final notesRefC = notesRef.toNativeUtf8().cast<Int8>();
|
||||
final noteC = note.toNativeUtf8().cast<Int8>();
|
||||
final notesRefC = notesRef.toNativeUtf8().cast<Char>();
|
||||
final noteC = note.toNativeUtf8().cast<Char>();
|
||||
final forceC = force ? 1 : 0;
|
||||
final error = libgit2.git_note_create(
|
||||
out,
|
||||
|
@ -120,7 +120,7 @@ void delete({
|
|||
required Pointer<git_signature> committerPointer,
|
||||
required Pointer<git_oid> oidPointer,
|
||||
}) {
|
||||
final notesRefC = notesRef.toNativeUtf8().cast<Int8>();
|
||||
final notesRefC = notesRef.toNativeUtf8().cast<Char>();
|
||||
|
||||
final error = libgit2.git_note_remove(
|
||||
repoPointer,
|
||||
|
|
|
@ -36,7 +36,7 @@ void addDiskAlternate({
|
|||
required Pointer<git_odb> odbPointer,
|
||||
required String path,
|
||||
}) {
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_odb_add_disk_alternate(odbPointer, pathC);
|
||||
calloc.free(pathC);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ int _forEachCb(
|
|||
List<Oid> objects(Pointer<git_odb> odb) {
|
||||
const except = -1;
|
||||
final cb =
|
||||
Pointer.fromFunction<Int32 Function(Pointer<git_oid>, Pointer<Void>)>(
|
||||
Pointer.fromFunction<Int Function(Pointer<git_oid>, Pointer<Void>)>(
|
||||
_forEachCb,
|
||||
except,
|
||||
);
|
||||
|
@ -184,7 +184,7 @@ Pointer<git_oid> write({
|
|||
throw LibGit2Error(libgit2.git_error_last());
|
||||
}
|
||||
|
||||
final bufferC = data.toNativeUtf8().cast<Int8>();
|
||||
final bufferC = data.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_odb_stream_write(stream.value, bufferC, data.length);
|
||||
|
||||
final out = calloc<git_oid>();
|
||||
|
|
|
@ -7,7 +7,7 @@ import 'package:libgit2dart/src/util.dart';
|
|||
/// Parse N characters of a hex formatted object id into a git_oid.
|
||||
Pointer<git_oid> fromStrN(String hex) {
|
||||
final out = calloc<git_oid>();
|
||||
final hexC = hex.toNativeUtf8().cast<Int8>();
|
||||
final hexC = hex.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_oid_fromstrn(out, hexC, hex.length);
|
||||
|
||||
calloc.free(hexC);
|
||||
|
@ -18,7 +18,7 @@ Pointer<git_oid> fromStrN(String hex) {
|
|||
/// Parse a hex formatted object id into a git_oid.
|
||||
Pointer<git_oid> fromSHA(String hex) {
|
||||
final out = calloc<git_oid>();
|
||||
final hexC = hex.toNativeUtf8().cast<Int8>();
|
||||
final hexC = hex.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_oid_fromstr(out, hexC);
|
||||
|
||||
calloc.free(hexC);
|
||||
|
@ -27,9 +27,9 @@ Pointer<git_oid> fromSHA(String hex) {
|
|||
}
|
||||
|
||||
/// Copy an already raw oid into a git_oid structure.
|
||||
Pointer<git_oid> fromRaw(Array<Uint8> raw) {
|
||||
Pointer<git_oid> fromRaw(Array<UnsignedChar> raw) {
|
||||
final out = calloc<git_oid>();
|
||||
final rawC = calloc<Uint8>(20);
|
||||
final rawC = calloc<UnsignedChar>(20);
|
||||
|
||||
for (var i = 0; i < 20; i++) {
|
||||
rawC[i] = raw[i];
|
||||
|
@ -44,7 +44,7 @@ Pointer<git_oid> fromRaw(Array<Uint8> raw) {
|
|||
|
||||
/// Format a git_oid into a hex string.
|
||||
String toSHA(Pointer<git_oid> id) {
|
||||
final out = calloc<Int8>(40);
|
||||
final out = calloc<Char>(40);
|
||||
libgit2.git_oid_fmt(out, id);
|
||||
|
||||
final result = out.cast<Utf8>().toDartString(length: 40);
|
||||
|
|
|
@ -121,7 +121,7 @@ void write({
|
|||
required Pointer<git_packbuilder> packbuilderPointer,
|
||||
String? path,
|
||||
}) {
|
||||
final pathC = path?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final pathC = path?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final error = libgit2.git_packbuilder_write(
|
||||
packbuilderPointer,
|
||||
pathC,
|
||||
|
|
|
@ -17,11 +17,11 @@ Pointer<git_patch> fromBuffers({
|
|||
required int interhunkLines,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_patch>>();
|
||||
final oldBufferC = oldBuffer?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final oldAsPathC = oldAsPath?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final oldBufferC = oldBuffer?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final oldAsPathC = oldAsPath?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final oldLen = oldBuffer?.length ?? 0;
|
||||
final newBufferC = newBuffer?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final newAsPathC = oldAsPath?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final newBufferC = newBuffer?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final newAsPathC = oldAsPath?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final newLen = newBuffer?.length ?? 0;
|
||||
final opts = _diffOptionsInit(
|
||||
flags: flags,
|
||||
|
@ -65,8 +65,8 @@ Pointer<git_patch> fromBlobs({
|
|||
required int interhunkLines,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_patch>>();
|
||||
final oldAsPathC = oldAsPath?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final newAsPathC = oldAsPath?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final oldAsPathC = oldAsPath?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final newAsPathC = oldAsPath?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final opts = _diffOptionsInit(
|
||||
flags: flags,
|
||||
contextLines: contextLines,
|
||||
|
@ -104,9 +104,9 @@ Pointer<git_patch> fromBlobAndBuffer({
|
|||
required int interhunkLines,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_patch>>();
|
||||
final oldAsPathC = oldAsPath?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final bufferC = buffer?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final bufferAsPathC = oldAsPath?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final oldAsPathC = oldAsPath?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final bufferC = buffer?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final bufferAsPathC = oldAsPath?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final bufferLen = buffer?.length ?? 0;
|
||||
final opts = _diffOptionsInit(
|
||||
flags: flags,
|
||||
|
@ -189,9 +189,9 @@ Map<String, Object> hunk({
|
|||
|
||||
/// Get line counts of each type in a patch.
|
||||
Map<String, int> lineStats(Pointer<git_patch> patch) {
|
||||
final context = calloc<Uint64>();
|
||||
final insertions = calloc<Uint64>();
|
||||
final deletions = calloc<Uint64>();
|
||||
final context = calloc<Size>();
|
||||
final insertions = calloc<Size>();
|
||||
final deletions = calloc<Size>();
|
||||
libgit2.git_patch_line_stats(
|
||||
context,
|
||||
insertions,
|
||||
|
|
|
@ -128,7 +128,7 @@ void commit({
|
|||
required String? message,
|
||||
}) {
|
||||
final out = calloc<git_oid>();
|
||||
final messageC = message?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final messageC = message?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
|
||||
final error = libgit2.git_rebase_commit(
|
||||
out,
|
||||
|
|
|
@ -55,7 +55,7 @@ Pointer<git_reference> lookup({
|
|||
required String name,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reference>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_reference_lookup(out, repoPointer, nameC);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -104,9 +104,9 @@ Pointer<git_reference> rename({
|
|||
String? logMessage,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reference>>();
|
||||
final newNameC = newName.toNativeUtf8().cast<Int8>();
|
||||
final newNameC = newName.toNativeUtf8().cast<Char>();
|
||||
final forceC = force == true ? 1 : 0;
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final error = libgit2.git_reference_rename(
|
||||
out,
|
||||
refPointer,
|
||||
|
@ -156,7 +156,7 @@ bool hasLog({
|
|||
required Pointer<git_repository> repoPointer,
|
||||
required String name,
|
||||
}) {
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final result = libgit2.git_reference_has_log(repoPointer, nameC);
|
||||
|
||||
calloc.free(nameC);
|
||||
|
@ -173,7 +173,7 @@ void ensureLog({
|
|||
required Pointer<git_repository> repoPointer,
|
||||
required String refName,
|
||||
}) {
|
||||
final refNameC = refName.toNativeUtf8().cast<Int8>();
|
||||
final refNameC = refName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_reference_ensure_log(repoPointer, refNameC);
|
||||
|
||||
calloc.free(refNameC);
|
||||
|
@ -237,9 +237,9 @@ Pointer<git_reference> createDirect({
|
|||
String? logMessage,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reference>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final forceC = force == true ? 1 : 0;
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final error = libgit2.git_reference_create(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -295,10 +295,10 @@ Pointer<git_reference> createSymbolic({
|
|||
String? logMessage,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reference>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final targetC = target.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final targetC = target.toNativeUtf8().cast<Char>();
|
||||
final forceC = force == true ? 1 : 0;
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final error = libgit2.git_reference_symbolic_create(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -348,7 +348,7 @@ Pointer<git_reference> setTarget({
|
|||
String? logMessage,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reference>>();
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final error = libgit2.git_reference_set_target(
|
||||
out,
|
||||
refPointer,
|
||||
|
@ -388,8 +388,8 @@ Pointer<git_reference> setTargetSymbolic({
|
|||
String? logMessage,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reference>>();
|
||||
final targetC = target.toNativeUtf8().cast<Int8>();
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final targetC = target.toNativeUtf8().cast<Char>();
|
||||
final logMessageC = logMessage?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final error = libgit2.git_reference_symbolic_set_target(
|
||||
out,
|
||||
refPointer,
|
||||
|
|
|
@ -15,7 +15,7 @@ Pointer<git_reflog> read({
|
|||
required String name,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_reflog>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_reflog_read(out, repoPointer, nameC);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -43,7 +43,7 @@ void delete({
|
|||
required Pointer<git_repository> repoPointer,
|
||||
required String name,
|
||||
}) {
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_reflog_delete(repoPointer, nameC);
|
||||
calloc.free(nameC);
|
||||
}
|
||||
|
@ -60,8 +60,8 @@ void rename({
|
|||
required String oldName,
|
||||
required String newName,
|
||||
}) {
|
||||
final oldNameC = oldName.toNativeUtf8().cast<Int8>();
|
||||
final newNameC = newName.toNativeUtf8().cast<Int8>();
|
||||
final oldNameC = oldName.toNativeUtf8().cast<Char>();
|
||||
final newNameC = newName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_reflog_rename(repoPointer, oldNameC, newNameC);
|
||||
|
||||
calloc.free(oldNameC);
|
||||
|
@ -82,7 +82,7 @@ void add({
|
|||
required String message,
|
||||
}) {
|
||||
final messageC =
|
||||
message.isEmpty ? nullptr : message.toNativeUtf8().cast<Int8>();
|
||||
message.isEmpty ? nullptr : message.toNativeUtf8().cast<Char>();
|
||||
|
||||
final error = libgit2.git_reflog_append(
|
||||
reflogPointer,
|
||||
|
|
|
@ -34,7 +34,7 @@ bool matchesSource({
|
|||
required Pointer<git_refspec> refspecPointer,
|
||||
required String refname,
|
||||
}) {
|
||||
final refnameC = refname.toNativeUtf8().cast<Int8>();
|
||||
final refnameC = refname.toNativeUtf8().cast<Char>();
|
||||
final result = libgit2.git_refspec_src_matches(refspecPointer, refnameC);
|
||||
|
||||
calloc.free(refnameC);
|
||||
|
@ -47,7 +47,7 @@ bool matchesDestination({
|
|||
required Pointer<git_refspec> refspecPointer,
|
||||
required String refname,
|
||||
}) {
|
||||
final refnameC = refname.toNativeUtf8().cast<Int8>();
|
||||
final refnameC = refname.toNativeUtf8().cast<Char>();
|
||||
final result = libgit2.git_refspec_dst_matches(refspecPointer, refnameC);
|
||||
|
||||
calloc.free(refnameC);
|
||||
|
@ -63,7 +63,7 @@ String transform({
|
|||
required String name,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_refspec_transform(out, refspecPointer, nameC);
|
||||
|
||||
final result = out.ref.ptr.cast<Utf8>().toDartString(length: out.ref.size);
|
||||
|
@ -88,7 +88,7 @@ String rTransform({
|
|||
required String name,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_refspec_rtransform(out, refspecPointer, nameC);
|
||||
|
||||
final result = out.ref.ptr.cast<Utf8>().toDartString(length: out.ref.size);
|
||||
|
|
|
@ -34,7 +34,7 @@ Pointer<git_remote> lookup({
|
|||
required String name,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_remote>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_remote_lookup(out, repoPointer, nameC);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -59,8 +59,8 @@ Pointer<git_remote> create({
|
|||
required String url,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_remote>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final urlC = url.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final urlC = url.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_remote_create(out, repoPointer, nameC, urlC);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -87,9 +87,9 @@ Pointer<git_remote> createWithFetchSpec({
|
|||
required String fetch,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_remote>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final urlC = url.toNativeUtf8().cast<Int8>();
|
||||
final fetchC = fetch.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final urlC = url.toNativeUtf8().cast<Char>();
|
||||
final fetchC = fetch.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_remote_create_with_fetchspec(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -122,7 +122,7 @@ void delete({
|
|||
required Pointer<git_repository> repoPointer,
|
||||
required String name,
|
||||
}) {
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_remote_delete(repoPointer, nameC);
|
||||
|
||||
calloc.free(nameC);
|
||||
|
@ -151,8 +151,8 @@ List<String> rename({
|
|||
required String newName,
|
||||
}) {
|
||||
final out = calloc<git_strarray>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final newNameC = newName.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final newNameC = newName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_remote_rename(out, repoPointer, nameC, newNameC);
|
||||
|
||||
calloc.free(nameC);
|
||||
|
@ -182,8 +182,8 @@ void setUrl({
|
|||
required String remote,
|
||||
required String url,
|
||||
}) {
|
||||
final remoteC = remote.toNativeUtf8().cast<Int8>();
|
||||
final urlC = url.toNativeUtf8().cast<Int8>();
|
||||
final remoteC = remote.toNativeUtf8().cast<Char>();
|
||||
final urlC = url.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_remote_set_url(repoPointer, remoteC, urlC);
|
||||
|
||||
calloc.free(remoteC);
|
||||
|
@ -205,8 +205,8 @@ void setPushUrl({
|
|||
required String remote,
|
||||
required String url,
|
||||
}) {
|
||||
final remoteC = remote.toNativeUtf8().cast<Int8>();
|
||||
final urlC = url.toNativeUtf8().cast<Int8>();
|
||||
final remoteC = remote.toNativeUtf8().cast<Char>();
|
||||
final urlC = url.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_remote_set_pushurl(repoPointer, remoteC, urlC);
|
||||
|
||||
calloc.free(remoteC);
|
||||
|
@ -285,8 +285,8 @@ void addFetch({
|
|||
required String remote,
|
||||
required String refspec,
|
||||
}) {
|
||||
final remoteC = remote.toNativeUtf8().cast<Int8>();
|
||||
final refspecC = refspec.toNativeUtf8().cast<Int8>();
|
||||
final remoteC = remote.toNativeUtf8().cast<Char>();
|
||||
final refspecC = refspec.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_remote_add_fetch(repoPointer, remoteC, refspecC);
|
||||
|
||||
calloc.free(remoteC);
|
||||
|
@ -308,8 +308,8 @@ void addPush({
|
|||
required String remote,
|
||||
required String refspec,
|
||||
}) {
|
||||
final remoteC = remote.toNativeUtf8().cast<Int8>();
|
||||
final refspecC = refspec.toNativeUtf8().cast<Int8>();
|
||||
final remoteC = remote.toNativeUtf8().cast<Char>();
|
||||
final refspecC = refspec.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_remote_add_push(repoPointer, remoteC, refspecC);
|
||||
|
||||
calloc.free(remoteC);
|
||||
|
@ -375,7 +375,7 @@ void connect({
|
|||
/// Throws a [LibGit2Error] if error occured.
|
||||
List<Map<String, Object?>> lsRemotes(Pointer<git_remote> remote) {
|
||||
final out = calloc<Pointer<Pointer<git_remote_head>>>();
|
||||
final size = calloc<Uint64>();
|
||||
final size = calloc<Size>();
|
||||
libgit2.git_remote_ls(out, size, remote);
|
||||
|
||||
final result = <Map<String, Object?>>[];
|
||||
|
@ -420,8 +420,8 @@ void fetch({
|
|||
}) {
|
||||
final refspecsC = calloc<git_strarray>();
|
||||
final refspecsPointers =
|
||||
refspecs.map((e) => e.toNativeUtf8().cast<Int8>()).toList();
|
||||
final strArray = calloc<Pointer<Int8>>(refspecs.length);
|
||||
refspecs.map((e) => e.toNativeUtf8().cast<Char>()).toList();
|
||||
final strArray = calloc<Pointer<Char>>(refspecs.length);
|
||||
|
||||
for (var i = 0; i < refspecs.length; i++) {
|
||||
strArray[i] = refspecsPointers[i];
|
||||
|
@ -429,7 +429,7 @@ void fetch({
|
|||
|
||||
refspecsC.ref.count = refspecs.length;
|
||||
refspecsC.ref.strings = strArray;
|
||||
final reflogMessageC = reflogMessage?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final reflogMessageC = reflogMessage?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
|
||||
final proxyOptions = _proxyOptionsInit(proxyOption);
|
||||
|
||||
|
@ -476,8 +476,8 @@ void push({
|
|||
}) {
|
||||
final refspecsC = calloc<git_strarray>();
|
||||
final refspecsPointers =
|
||||
refspecs.map((e) => e.toNativeUtf8().cast<Int8>()).toList();
|
||||
final strArray = calloc<Pointer<Int8>>(refspecs.length);
|
||||
refspecs.map((e) => e.toNativeUtf8().cast<Char>()).toList();
|
||||
final strArray = calloc<Pointer<Char>>(refspecs.length);
|
||||
|
||||
for (var i = 0; i < refspecs.length; i++) {
|
||||
strArray[i] = refspecsPointers[i];
|
||||
|
@ -566,7 +566,7 @@ Pointer<git_proxy_options> _proxyOptionsInit(String? proxyOption) {
|
|||
proxyOptions.ref.type = git_proxy_t.GIT_PROXY_AUTO;
|
||||
} else {
|
||||
proxyOptions.ref.type = git_proxy_t.GIT_PROXY_SPECIFIED;
|
||||
proxyOptions.ref.url = proxyOption.toNativeUtf8().cast<Int8>();
|
||||
proxyOptions.ref.url = proxyOption.toNativeUtf8().cast<Char>();
|
||||
}
|
||||
|
||||
return proxyOptions;
|
||||
|
|
|
@ -29,7 +29,7 @@ class RemoteCallbacks {
|
|||
|
||||
/// Callback for messages received by the transport.
|
||||
static int sidebandProgressCb(
|
||||
Pointer<Int8> progressOutput,
|
||||
Pointer<Char> progressOutput,
|
||||
int length,
|
||||
Pointer<Void> payload,
|
||||
) {
|
||||
|
@ -42,7 +42,7 @@ class RemoteCallbacks {
|
|||
|
||||
/// A callback that will be called for every reference.
|
||||
static int updateTipsCb(
|
||||
Pointer<Int8> refname,
|
||||
Pointer<Char> refname,
|
||||
Pointer<git_oid> oldOid,
|
||||
Pointer<git_oid> newOid,
|
||||
Pointer<Void> payload,
|
||||
|
@ -58,8 +58,8 @@ class RemoteCallbacks {
|
|||
/// not empty, the update was rejected by the remote server
|
||||
/// and [message] contains the reason given.
|
||||
static int pushUpdateReferenceCb(
|
||||
Pointer<Int8> refname,
|
||||
Pointer<Int8> message,
|
||||
Pointer<Char> refname,
|
||||
Pointer<Char> message,
|
||||
Pointer<Void> payload,
|
||||
) {
|
||||
final messageResult =
|
||||
|
@ -77,8 +77,8 @@ class RemoteCallbacks {
|
|||
static int remoteCb(
|
||||
Pointer<Pointer<git_remote>> remote,
|
||||
Pointer<git_repository> repo,
|
||||
Pointer<Int8> name,
|
||||
Pointer<Int8> url,
|
||||
Pointer<Char> name,
|
||||
Pointer<Char> url,
|
||||
Pointer<Void> payload,
|
||||
) {
|
||||
late final Pointer<git_remote> remotePointer;
|
||||
|
@ -110,7 +110,7 @@ class RemoteCallbacks {
|
|||
/// A callback used to create the new repository into which to clone.
|
||||
static int repositoryCb(
|
||||
Pointer<Pointer<git_repository>> repo,
|
||||
Pointer<Int8> path,
|
||||
Pointer<Char> path,
|
||||
int bare,
|
||||
Pointer<Void> payload,
|
||||
) {
|
||||
|
@ -147,15 +147,15 @@ class RemoteCallbacks {
|
|||
/// requires authentication in order to connect to it.
|
||||
static int credentialsCb(
|
||||
Pointer<Pointer<git_credential>> credPointer,
|
||||
Pointer<Int8> url,
|
||||
Pointer<Int8> username,
|
||||
Pointer<Char> url,
|
||||
Pointer<Char> username,
|
||||
int allowedTypes,
|
||||
Pointer<Void> payload,
|
||||
) {
|
||||
if (payload.cast<Int8>().value == 2) {
|
||||
if (payload.cast<Char>().value == 2) {
|
||||
libgit2.git_error_set_str(
|
||||
git_error_t.GIT_ERROR_INVALID,
|
||||
'Incorrect credentials.'.toNativeUtf8().cast<Int8>(),
|
||||
'Incorrect credentials.'.toNativeUtf8().cast<Char>(),
|
||||
);
|
||||
throw LibGit2Error(libgit2.git_error_last());
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class RemoteCallbacks {
|
|||
if (allowedTypes & credentialType.value != credentialType.value) {
|
||||
libgit2.git_error_set_str(
|
||||
git_error_t.GIT_ERROR_INVALID,
|
||||
'Invalid credential type $credentialType'.toNativeUtf8().cast<Int8>(),
|
||||
'Invalid credential type $credentialType'.toNativeUtf8().cast<Char>(),
|
||||
);
|
||||
throw LibGit2Error(libgit2.git_error_last());
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import 'package:libgit2dart/src/util.dart';
|
|||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_repository> open(String path) {
|
||||
final out = calloc<Pointer<git_repository>>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_repository_open(out, pathC);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -44,8 +44,8 @@ String discover({
|
|||
String? ceilingDirs,
|
||||
}) {
|
||||
final out = calloc<git_buf>();
|
||||
final startPathC = startPath.toNativeUtf8().cast<Int8>();
|
||||
final ceilingDirsC = ceilingDirs?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final startPathC = startPath.toNativeUtf8().cast<Char>();
|
||||
final ceilingDirsC = ceilingDirs?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
|
||||
libgit2.git_repository_discover(out, startPathC, 0, ceilingDirsC);
|
||||
|
||||
|
@ -75,12 +75,12 @@ Pointer<git_repository> init({
|
|||
String? originUrl,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_repository>>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final workdirPathC = workdirPath?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final descriptionC = description?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final templatePathC = templatePath?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final initialHeadC = initialHead?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final originUrlC = originUrl?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final workdirPathC = workdirPath?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final descriptionC = description?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final templatePathC = templatePath?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final initialHeadC = initialHead?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final originUrlC = originUrl?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final opts = calloc<git_repository_init_options>();
|
||||
libgit2.git_repository_init_options_init(
|
||||
opts,
|
||||
|
@ -130,10 +130,10 @@ Pointer<git_repository> clone({
|
|||
required Callbacks callbacks,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_repository>>();
|
||||
final urlC = url.toNativeUtf8().cast<Int8>();
|
||||
final localPathC = localPath.toNativeUtf8().cast<Int8>();
|
||||
final urlC = url.toNativeUtf8().cast<Char>();
|
||||
final localPathC = localPath.toNativeUtf8().cast<Char>();
|
||||
final checkoutBranchC =
|
||||
checkoutBranch?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
checkoutBranch?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
|
||||
final cloneOptions = calloc<git_clone_options>();
|
||||
libgit2.git_clone_options_init(cloneOptions, GIT_CLONE_OPTIONS_VERSION);
|
||||
|
@ -224,7 +224,7 @@ void setNamespace({
|
|||
required Pointer<git_repository> repoPointer,
|
||||
String? namespace,
|
||||
}) {
|
||||
final namespaceC = namespace?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final namespaceC = namespace?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
libgit2.git_repository_set_namespace(repoPointer, namespaceC);
|
||||
calloc.free(namespaceC);
|
||||
}
|
||||
|
@ -311,8 +311,8 @@ void setIdentity({
|
|||
String? name,
|
||||
String? email,
|
||||
}) {
|
||||
final nameC = name?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final emailC = email?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final nameC = name?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final emailC = email?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
|
||||
libgit2.git_repository_set_ident(repoPointer, nameC, emailC);
|
||||
|
||||
|
@ -324,8 +324,8 @@ void setIdentity({
|
|||
///
|
||||
/// Returns list with name and email respectively.
|
||||
List<String> identity(Pointer<git_repository> repo) {
|
||||
final name = calloc<Pointer<Int8>>();
|
||||
final email = calloc<Pointer<Int8>>();
|
||||
final name = calloc<Pointer<Char>>();
|
||||
final email = calloc<Pointer<Char>>();
|
||||
libgit2.git_repository_ident(name, email, repo);
|
||||
final identity = <String>[];
|
||||
|
||||
|
@ -495,7 +495,7 @@ void setHead({
|
|||
required Pointer<git_repository> repoPointer,
|
||||
required String refname,
|
||||
}) {
|
||||
final refnameC = refname.toNativeUtf8().cast<Int8>();
|
||||
final refnameC = refname.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_repository_set_head(repoPointer, refnameC);
|
||||
|
||||
calloc.free(refnameC);
|
||||
|
@ -546,7 +546,7 @@ void setWorkdir({
|
|||
required String path,
|
||||
required bool updateGitlink,
|
||||
}) {
|
||||
final workdirC = path.toNativeUtf8().cast<Int8>();
|
||||
final workdirC = path.toNativeUtf8().cast<Char>();
|
||||
final updateGitlinkC = updateGitlink ? 1 : 0;
|
||||
final error = libgit2.git_repository_set_workdir(
|
||||
repoPointer,
|
||||
|
|
|
@ -41,8 +41,8 @@ void resetDefault({
|
|||
}) {
|
||||
final pathspecC = calloc<git_strarray>();
|
||||
final pathPointers =
|
||||
pathspec.map((e) => e.toNativeUtf8().cast<Int8>()).toList();
|
||||
final strArray = calloc<Pointer<Int8>>(pathspec.length);
|
||||
pathspec.map((e) => e.toNativeUtf8().cast<Char>()).toList();
|
||||
final strArray = calloc<Pointer<Char>>(pathspec.length);
|
||||
|
||||
for (var i = 0; i < pathspec.length; i++) {
|
||||
strArray[i] = pathPointers[i];
|
||||
|
|
|
@ -16,7 +16,7 @@ Pointer<git_revspec> revParse({
|
|||
required String spec,
|
||||
}) {
|
||||
final out = calloc<git_revspec>();
|
||||
final specC = spec.toNativeUtf8().cast<Int8>();
|
||||
final specC = spec.toNativeUtf8().cast<Char>();
|
||||
|
||||
final error = libgit2.git_revparse(out, repoPointer, specC);
|
||||
|
||||
|
@ -42,7 +42,7 @@ Pointer<git_object> revParseSingle({
|
|||
required String spec,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_object>>();
|
||||
final specC = spec.toNativeUtf8().cast<Int8>();
|
||||
final specC = spec.toNativeUtf8().cast<Char>();
|
||||
|
||||
final error = libgit2.git_revparse_single(out, repoPointer, specC);
|
||||
|
||||
|
@ -76,7 +76,7 @@ List<Pointer> revParseExt({
|
|||
}) {
|
||||
final objectOut = calloc<Pointer<git_object>>();
|
||||
final referenceOut = calloc<Pointer<git_reference>>();
|
||||
final specC = spec.toNativeUtf8().cast<Int8>();
|
||||
final specC = spec.toNativeUtf8().cast<Char>();
|
||||
|
||||
final error = libgit2.git_revparse_ext(
|
||||
objectOut,
|
||||
|
|
|
@ -81,7 +81,7 @@ void pushGlob({
|
|||
required Pointer<git_revwalk> walkerPointer,
|
||||
required String glob,
|
||||
}) {
|
||||
final globC = glob.toNativeUtf8().cast<Int8>();
|
||||
final globC = glob.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_revwalk_push_glob(walkerPointer, globC);
|
||||
calloc.free(globC);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ void pushRef({
|
|||
required Pointer<git_revwalk> walkerPointer,
|
||||
required String refName,
|
||||
}) {
|
||||
final refNameC = refName.toNativeUtf8().cast<Int8>();
|
||||
final refNameC = refName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_revwalk_push_ref(walkerPointer, refNameC);
|
||||
|
||||
calloc.free(refNameC);
|
||||
|
@ -119,7 +119,7 @@ void pushRange({
|
|||
required Pointer<git_revwalk> walkerPointer,
|
||||
required String range,
|
||||
}) {
|
||||
final rangeC = range.toNativeUtf8().cast<Int8>();
|
||||
final rangeC = range.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_revwalk_push_range(walkerPointer, rangeC);
|
||||
|
||||
calloc.free(rangeC);
|
||||
|
@ -199,7 +199,7 @@ void hideGlob({
|
|||
required Pointer<git_revwalk> walkerPointer,
|
||||
required String glob,
|
||||
}) {
|
||||
final globC = glob.toNativeUtf8().cast<Int8>();
|
||||
final globC = glob.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_revwalk_hide_glob(walkerPointer, globC);
|
||||
calloc.free(globC);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ void hideRef({
|
|||
required Pointer<git_revwalk> walkerPointer,
|
||||
required String refName,
|
||||
}) {
|
||||
final refNameC = refName.toNativeUtf8().cast<Int8>();
|
||||
final refNameC = refName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_revwalk_hide_ref(walkerPointer, refNameC);
|
||||
|
||||
calloc.free(refNameC);
|
||||
|
|
|
@ -19,8 +19,8 @@ Pointer<git_signature> create({
|
|||
required int offset,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_signature>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final emailC = email.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final emailC = email.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_signature_new(out, nameC, emailC, time, offset);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -42,8 +42,8 @@ Pointer<git_signature> create({
|
|||
/// Throws a [LibGit2Error] if error occured.
|
||||
Pointer<git_signature> now({required String name, required String email}) {
|
||||
final out = calloc<Pointer<git_signature>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final emailC = email.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final emailC = email.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_signature_now(out, nameC, emailC);
|
||||
|
||||
final result = out.value;
|
||||
|
|
|
@ -18,7 +18,7 @@ Pointer<git_oid> save({
|
|||
required int flags,
|
||||
}) {
|
||||
final out = calloc<git_oid>();
|
||||
final messageC = message?.toNativeUtf8().cast<Int8>() ?? nullptr;
|
||||
final messageC = message?.toNativeUtf8().cast<Char>() ?? nullptr;
|
||||
final error = libgit2.git_stash_save(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -143,7 +143,7 @@ var _stashList = <Stash>[];
|
|||
/// A callback function to iterate over all the stashed states.
|
||||
int _stashCb(
|
||||
int index,
|
||||
Pointer<Int8> message,
|
||||
Pointer<Char> message,
|
||||
Pointer<git_oid> oid,
|
||||
Pointer<Void> payload,
|
||||
) {
|
||||
|
|
|
@ -62,8 +62,8 @@ Pointer<git_status_entry> getByIndex({
|
|||
///
|
||||
/// Throws a [LibGit2Error] if error occured.
|
||||
int file({required Pointer<git_repository> repoPointer, required String path}) {
|
||||
final out = calloc<Uint32>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final out = calloc<UnsignedInt>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_status_file(out, repoPointer, pathC);
|
||||
|
||||
final result = out.value;
|
||||
|
|
|
@ -15,7 +15,7 @@ List<String> _pathsList = [];
|
|||
/// Function to be called with the name of each submodule.
|
||||
int _listCb(
|
||||
Pointer<git_submodule> submodule,
|
||||
Pointer<Int8> name,
|
||||
Pointer<Char> name,
|
||||
Pointer<Void> payload,
|
||||
) {
|
||||
_pathsList.add(path(submodule));
|
||||
|
@ -26,7 +26,7 @@ int _listCb(
|
|||
List<String> list(Pointer<git_repository> repo) {
|
||||
const except = -1;
|
||||
final callback = Pointer.fromFunction<
|
||||
Int32 Function(Pointer<git_submodule>, Pointer<Int8>, Pointer<Void>)>(
|
||||
Int Function(Pointer<git_submodule>, Pointer<Char>, Pointer<Void>)>(
|
||||
_listCb,
|
||||
except,
|
||||
);
|
||||
|
@ -50,7 +50,7 @@ Pointer<git_submodule> lookup({
|
|||
required String name,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_submodule>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
|
||||
final error = libgit2.git_submodule_lookup(out, repoPointer, nameC);
|
||||
|
||||
|
@ -159,8 +159,8 @@ Pointer<git_submodule> addSetup({
|
|||
bool useGitlink = true,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_submodule>>();
|
||||
final urlC = url.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final urlC = url.toNativeUtf8().cast<Char>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final useGitlinkC = useGitlink ? 1 : 0;
|
||||
final error = libgit2.git_submodule_add_setup(
|
||||
out,
|
||||
|
@ -232,8 +232,8 @@ int status({
|
|||
required String name,
|
||||
required int ignore,
|
||||
}) {
|
||||
final out = calloc<Uint32>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final out = calloc<UnsignedInt>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_submodule_status(out, repoPointer, nameC, ignore);
|
||||
|
||||
final result = out.value;
|
||||
|
@ -294,8 +294,8 @@ void setUrl({
|
|||
required String name,
|
||||
required String url,
|
||||
}) {
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final urlC = url.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final urlC = url.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_submodule_set_url(repoPointer, nameC, urlC);
|
||||
|
||||
|
@ -318,8 +318,8 @@ void setBranch({
|
|||
required String name,
|
||||
required String branch,
|
||||
}) {
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final branchC = branch.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final branchC = branch.toNativeUtf8().cast<Char>();
|
||||
|
||||
libgit2.git_submodule_set_branch(repoPointer, nameC, branchC);
|
||||
|
||||
|
@ -369,7 +369,7 @@ void setIgnore({
|
|||
required String name,
|
||||
required int ignore,
|
||||
}) {
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_submodule_set_ignore(repoPointer, nameC, ignore);
|
||||
calloc.free(nameC);
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ void setUpdateRule({
|
|||
required String name,
|
||||
required int update,
|
||||
}) {
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
libgit2.git_submodule_set_update(repoPointer, nameC, update);
|
||||
calloc.free(nameC);
|
||||
}
|
||||
|
|
|
@ -115,8 +115,8 @@ Pointer<git_oid> createAnnotated({
|
|||
required bool force,
|
||||
}) {
|
||||
final out = calloc<git_oid>();
|
||||
final tagNameC = tagName.toNativeUtf8().cast<Int8>();
|
||||
final messageC = message.toNativeUtf8().cast<Int8>();
|
||||
final tagNameC = tagName.toNativeUtf8().cast<Char>();
|
||||
final messageC = message.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_tag_create(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -155,7 +155,7 @@ Pointer<git_oid> createLightweight({
|
|||
required bool force,
|
||||
}) {
|
||||
final out = calloc<git_oid>();
|
||||
final tagNameC = tagName.toNativeUtf8().cast<Int8>();
|
||||
final tagNameC = tagName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_tag_create_lightweight(
|
||||
out,
|
||||
repoPointer,
|
||||
|
@ -183,7 +183,7 @@ void delete({
|
|||
required Pointer<git_repository> repoPointer,
|
||||
required String tagName,
|
||||
}) {
|
||||
final tagNameC = tagName.toNativeUtf8().cast<Int8>();
|
||||
final tagNameC = tagName.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_tag_delete(repoPointer, tagNameC);
|
||||
|
||||
calloc.free(tagNameC);
|
||||
|
|
|
@ -59,7 +59,7 @@ Pointer<git_tree_entry> getByName({
|
|||
required Pointer<git_tree> treePointer,
|
||||
required String filename,
|
||||
}) {
|
||||
final filenameC = filename.toNativeUtf8().cast<Int8>();
|
||||
final filenameC = filename.toNativeUtf8().cast<Char>();
|
||||
final result = libgit2.git_tree_entry_byname(treePointer, filenameC);
|
||||
|
||||
calloc.free(filenameC);
|
||||
|
@ -83,7 +83,7 @@ Pointer<git_tree_entry> getByPath({
|
|||
required String path,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_tree_entry>>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_tree_entry_bypath(out, rootPointer, pathC);
|
||||
|
||||
final result = out.value;
|
||||
|
|
|
@ -53,7 +53,7 @@ Pointer<git_tree_entry> getByFilename({
|
|||
required Pointer<git_treebuilder> builderPointer,
|
||||
required String filename,
|
||||
}) {
|
||||
final filenameC = filename.toNativeUtf8().cast<Int8>();
|
||||
final filenameC = filename.toNativeUtf8().cast<Char>();
|
||||
final result = libgit2.git_treebuilder_get(builderPointer, filenameC);
|
||||
|
||||
calloc.free(filenameC);
|
||||
|
@ -82,7 +82,7 @@ void add({
|
|||
required Pointer<git_oid> oidPointer,
|
||||
required int filemode,
|
||||
}) {
|
||||
final filenameC = filename.toNativeUtf8().cast<Int8>();
|
||||
final filenameC = filename.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_treebuilder_insert(
|
||||
nullptr,
|
||||
builderPointer,
|
||||
|
@ -105,7 +105,7 @@ void remove({
|
|||
required Pointer<git_treebuilder> builderPointer,
|
||||
required String filename,
|
||||
}) {
|
||||
final filenameC = filename.toNativeUtf8().cast<Int8>();
|
||||
final filenameC = filename.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_treebuilder_remove(builderPointer, filenameC);
|
||||
|
||||
calloc.free(filenameC);
|
||||
|
|
|
@ -20,8 +20,8 @@ Pointer<git_worktree> create({
|
|||
Pointer<git_reference>? refPointer,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_worktree>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final pathC = path.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final pathC = path.toNativeUtf8().cast<Char>();
|
||||
|
||||
final opts = calloc<git_worktree_add_options>();
|
||||
libgit2.git_worktree_add_options_init(opts, GIT_WORKTREE_ADD_OPTIONS_VERSION);
|
||||
|
@ -56,7 +56,7 @@ Pointer<git_worktree> lookup({
|
|||
required String name,
|
||||
}) {
|
||||
final out = calloc<Pointer<git_worktree>>();
|
||||
final nameC = name.toNativeUtf8().cast<Int8>();
|
||||
final nameC = name.toNativeUtf8().cast<Char>();
|
||||
final error = libgit2.git_worktree_lookup(out, repoPointer, nameC);
|
||||
|
||||
final result = out.value;
|
||||
|
|
|
@ -348,7 +348,7 @@ class IndexEntry extends Equatable {
|
|||
String get path => _indexEntryPointer.ref.path.cast<Utf8>().toDartString();
|
||||
|
||||
set path(String path) =>
|
||||
_indexEntryPointer.ref.path = path.toNativeUtf8().cast<Int8>();
|
||||
_indexEntryPointer.ref.path = path.toNativeUtf8().cast<Char>();
|
||||
|
||||
/// UNIX file attributes of a index entry.
|
||||
GitFilemode get mode {
|
||||
|
|
|
@ -12,9 +12,9 @@ class Libgit2 {
|
|||
static String get version {
|
||||
libgit2.git_libgit2_init();
|
||||
|
||||
final major = calloc<Int32>();
|
||||
final minor = calloc<Int32>();
|
||||
final rev = calloc<Int32>();
|
||||
final major = calloc<Int>();
|
||||
final minor = calloc<Int>();
|
||||
final rev = calloc<Int>();
|
||||
libgit2.git_libgit2_version(major, minor, rev);
|
||||
|
||||
final version = '${major.value}.${minor.value}.${rev.value}';
|
||||
|
@ -39,8 +39,8 @@ class Libgit2 {
|
|||
static bool get ownerValidation {
|
||||
libgit2.git_libgit2_init();
|
||||
|
||||
final out = calloc<Int8>();
|
||||
libgit2.git_libgit2_opts(
|
||||
final out = calloc<Char>();
|
||||
libgit2Opts.git_libgit2_opts(
|
||||
git_libgit2_opt_t.GIT_OPT_GET_OWNER_VALIDATION,
|
||||
out,
|
||||
);
|
||||
|
@ -53,8 +53,9 @@ class Libgit2 {
|
|||
/// Sets owner validation setting for repository directories.
|
||||
static set ownerValidation(bool value) {
|
||||
libgit2.git_libgit2_init();
|
||||
|
||||
final valueC = value ? 1 : 0;
|
||||
libgit2.git_libgit2_opts_set(
|
||||
libgit2Opts.git_libgit2_opts_set(
|
||||
git_libgit2_opt_t.GIT_OPT_SET_OWNER_VALIDATION,
|
||||
valueC,
|
||||
);
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:cli_util/cli_logging.dart' show Ansi, Logger;
|
||||
import 'package:libgit2dart/src/bindings/libgit2_bindings.dart';
|
||||
import 'package:libgit2dart/src/bindings/libgit2_opts_bindings.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:pub_cache/pub_cache.dart';
|
||||
|
||||
|
@ -78,19 +78,16 @@ DynamicLibrary loadLibrary(String name) {
|
|||
_resolveLibPath(name) ?? name,
|
||||
);
|
||||
} catch (e) {
|
||||
final logger = Logger.standard();
|
||||
final ansi = Ansi(Ansi.terminalSupportsAnsi);
|
||||
|
||||
logger.stderr(
|
||||
'${ansi.red}Failed to open the library. Make sure that libgit2 '
|
||||
'library is bundled with the application.${ansi.none}',
|
||||
stderr.writeln(
|
||||
'Failed to open the library. Make sure that libgit2 library is bundled '
|
||||
'with the application.',
|
||||
);
|
||||
logger.stdout(ansi.none);
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
final libgit2 = Libgit2(loadLibrary(getLibName()));
|
||||
final libgit2Opts = Libgit2Opts(loadLibrary(getLibName()));
|
||||
|
||||
bool isValidShaHex(String str) {
|
||||
final hexRegExp = RegExp(r'^[0-9a-fA-F]+$');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
name: libgit2dart
|
||||
|
||||
description: Dart bindings to libgit2.
|
||||
description: Dart bindings to libgit2, provides ability to use libgit2 library in Dart and Flutter.
|
||||
|
||||
version: 1.0.0
|
||||
|
||||
|
@ -8,11 +8,10 @@ homepage: https://github.com/SkinnyMind/libgit2dart
|
|||
|
||||
environment:
|
||||
sdk: ">=2.17.0 <3.0.0"
|
||||
flutter: ">=2.13.0-0.0.pre.578"
|
||||
flutter: ">=3.0.0"
|
||||
|
||||
dependencies:
|
||||
args: ^2.3.0
|
||||
cli_util: ^0.3.5
|
||||
equatable: ^2.0.3
|
||||
ffi: ^1.1.2
|
||||
meta: ^1.7.0
|
||||
|
@ -20,7 +19,7 @@ dependencies:
|
|||
pub_cache: ^0.3.1
|
||||
|
||||
dev_dependencies:
|
||||
ffigen: ^4.1.2
|
||||
ffigen: ^5.0.0
|
||||
lints: ^2.0.0
|
||||
test: ^1.20.0
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue