mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat: upgrade libgit2 to 1.4.0
This commit is contained in:
parent
7a067beeb9
commit
bb433689cd
16 changed files with 705 additions and 253 deletions
File diff suppressed because it is too large
Load diff
|
@ -143,12 +143,13 @@ int writtenCount(Pointer<git_packbuilder> pb) {
|
||||||
return libgit2.git_packbuilder_written(pb);
|
return libgit2.git_packbuilder_written(pb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the packfile's hash.
|
/// Get the unique name for the resulting packfile.
|
||||||
///
|
///
|
||||||
/// A packfile's name is derived from the sorted hashing of all object names.
|
/// The packfile's name is derived from the packfile's content. This is only
|
||||||
/// This is only correct after the packfile has been written.
|
/// correct after the packfile has been written.
|
||||||
Pointer<git_oid> hash(Pointer<git_packbuilder> pb) {
|
String name(Pointer<git_packbuilder> pb) {
|
||||||
return libgit2.git_packbuilder_hash(pb);
|
final result = libgit2.git_packbuilder_name(pb);
|
||||||
|
return result == nullptr ? '' : result.cast<Utf8>().toDartString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set number of threads to spawn.
|
/// Set number of threads to spawn.
|
||||||
|
|
|
@ -447,6 +447,14 @@ class GitMergeFileFlag {
|
||||||
/// Take extra time to find minimal diff.
|
/// Take extra time to find minimal diff.
|
||||||
static const diffMinimal = GitMergeFileFlag._(128, 'diffMinimal');
|
static const diffMinimal = GitMergeFileFlag._(128, 'diffMinimal');
|
||||||
|
|
||||||
|
/// Create zdiff3 ("zealous diff3")-style files.
|
||||||
|
static const styleZdiff3 = GitMergeFileFlag._(256, 'styleZdiff3');
|
||||||
|
|
||||||
|
/// Do not produce file conflicts when common regions have
|
||||||
|
/// changed; keep the conflict markers in the file and accept
|
||||||
|
/// that as the merge result.
|
||||||
|
static const acceptConflicts = GitMergeFileFlag._(512, 'acceptConflicts');
|
||||||
|
|
||||||
static const List<GitMergeFileFlag> values = [
|
static const List<GitMergeFileFlag> values = [
|
||||||
defaults,
|
defaults,
|
||||||
styleMerge,
|
styleMerge,
|
||||||
|
@ -457,6 +465,8 @@ class GitMergeFileFlag {
|
||||||
ignoreWhitespaceEOL,
|
ignoreWhitespaceEOL,
|
||||||
diffPatience,
|
diffPatience,
|
||||||
diffMinimal,
|
diffMinimal,
|
||||||
|
styleZdiff3,
|
||||||
|
acceptConflicts,
|
||||||
];
|
];
|
||||||
|
|
||||||
int get value => _value;
|
int get value => _value;
|
||||||
|
@ -554,6 +564,10 @@ class GitCheckout {
|
||||||
/// notifications; don't update the working directory or index.
|
/// notifications; don't update the working directory or index.
|
||||||
static const dryRun = GitCheckout._(16777216, 'dryRun');
|
static const dryRun = GitCheckout._(16777216, 'dryRun');
|
||||||
|
|
||||||
|
/// Include common ancestor data in zdiff3 format for conflicts.
|
||||||
|
static const conflictStyleZdiff3 =
|
||||||
|
GitCheckout._(33554432, 'conflictStyleZdiff3');
|
||||||
|
|
||||||
static const List<GitCheckout> values = [
|
static const List<GitCheckout> values = [
|
||||||
none,
|
none,
|
||||||
safe,
|
safe,
|
||||||
|
@ -575,7 +589,8 @@ class GitCheckout {
|
||||||
conflictStyleDiff3,
|
conflictStyleDiff3,
|
||||||
dontRemoveExisting,
|
dontRemoveExisting,
|
||||||
dontWriteIndex,
|
dontWriteIndex,
|
||||||
dryRun
|
dryRun,
|
||||||
|
conflictStyleZdiff3,
|
||||||
];
|
];
|
||||||
|
|
||||||
int get value => _value;
|
int get value => _value;
|
||||||
|
|
|
@ -90,11 +90,11 @@ class PackBuilder {
|
||||||
/// Number of objects the packbuilder has already written out.
|
/// Number of objects the packbuilder has already written out.
|
||||||
int get writtenLength => bindings.writtenCount(_packbuilderPointer);
|
int get writtenLength => bindings.writtenCount(_packbuilderPointer);
|
||||||
|
|
||||||
/// Packfile's hash.
|
/// Unique name for the resulting packfile.
|
||||||
///
|
///
|
||||||
/// A packfile's name is derived from the sorted hashing of all object names.
|
/// The packfile's name is derived from the packfile's content. This is only
|
||||||
/// This is only correct after the packfile has been written.
|
/// correct after the packfile has been written.
|
||||||
Oid get hash => Oid(bindings.hash(_packbuilderPointer));
|
String get name => bindings.name(_packbuilderPointer);
|
||||||
|
|
||||||
/// Sets and returns the number of threads to spawn.
|
/// Sets and returns the number of threads to spawn.
|
||||||
///
|
///
|
||||||
|
|
|
@ -8,7 +8,7 @@ import 'package:libgit2dart/src/bindings/libgit2_bindings.dart';
|
||||||
import 'package:path/path.dart' as path;
|
import 'package:path/path.dart' as path;
|
||||||
import 'package:pub_cache/pub_cache.dart';
|
import 'package:pub_cache/pub_cache.dart';
|
||||||
|
|
||||||
const libgit2Version = '1.3.0';
|
const libgit2Version = '1.4.0';
|
||||||
final libDir = path.join('.dart_tool', 'libgit2');
|
final libDir = path.join('.dart_tool', 'libgit2');
|
||||||
|
|
||||||
String getLibName() {
|
String getLibName() {
|
||||||
|
|
|
@ -20,6 +20,6 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE PkgConfig::GTK)
|
||||||
|
|
||||||
# List of absolute paths to libraries that should be bundled with the plugin
|
# List of absolute paths to libraries that should be bundled with the plugin
|
||||||
set(libgit2dart_bundled_libraries
|
set(libgit2dart_bundled_libraries
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/libgit2-1.3.0.so"
|
"${CMAKE_CURRENT_SOURCE_DIR}/libgit2-1.4.0.so"
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
BIN
linux/libgit2-1.4.0.so
Normal file
BIN
linux/libgit2-1.4.0.so
Normal file
Binary file not shown.
Binary file not shown.
BIN
macos/libgit2-1.4.0.dylib
Normal file
BIN
macos/libgit2-1.4.0.dylib
Normal file
Binary file not shown.
|
@ -15,7 +15,7 @@ Dart bindings to libgit2.
|
||||||
s.source = { :path => '.' }
|
s.source = { :path => '.' }
|
||||||
s.source_files = 'Classes/**/*'
|
s.source_files = 'Classes/**/*'
|
||||||
s.dependency 'FlutterMacOS'
|
s.dependency 'FlutterMacOS'
|
||||||
s.vendored_libraries = 'libgit2-1.3.0.dylib'
|
s.vendored_libraries = 'libgit2-1.4.0.dylib'
|
||||||
|
|
||||||
s.platform = :osx, '10.11'
|
s.platform = :osx, '10.11'
|
||||||
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
||||||
|
|
|
@ -105,7 +105,7 @@ void main() {
|
||||||
final callbacks = Callbacks(credentials: keypair);
|
final callbacks = Callbacks(credentials: keypair);
|
||||||
|
|
||||||
final repo = Repository.clone(
|
final repo = Repository.clone(
|
||||||
url: 'https://github.com/libgit2/TestGitRepository',
|
url: 'ssh://git@github.com/libgit2/TestGitRepository',
|
||||||
localPath: cloneDir.path,
|
localPath: cloneDir.path,
|
||||||
callbacks: callbacks,
|
callbacks: callbacks,
|
||||||
);
|
);
|
||||||
|
@ -195,7 +195,7 @@ void main() {
|
||||||
final callbacks = Callbacks(credentials: keypair);
|
final callbacks = Callbacks(credentials: keypair);
|
||||||
|
|
||||||
final repo = Repository.clone(
|
final repo = Repository.clone(
|
||||||
url: 'https://github.com/libgit2/TestGitRepository',
|
url: 'ssh://git@github.com/libgit2/TestGitRepository',
|
||||||
localPath: cloneDir.path,
|
localPath: cloneDir.path,
|
||||||
callbacks: callbacks,
|
callbacks: callbacks,
|
||||||
);
|
);
|
||||||
|
|
|
@ -165,7 +165,7 @@ void main() {
|
||||||
|
|
||||||
group('GitMergeFileFlag', () {
|
group('GitMergeFileFlag', () {
|
||||||
test('returns correct values', () {
|
test('returns correct values', () {
|
||||||
const expected = [0, 1, 2, 4, 8, 16, 32, 64, 128];
|
const expected = [0, 1, 2, 4, 8, 16, 32, 64, 128, 256, 512];
|
||||||
final actual = GitMergeFileFlag.values.map((e) => e.value).toList();
|
final actual = GitMergeFileFlag.values.map((e) => e.value).toList();
|
||||||
expect(actual, expected);
|
expect(actual, expected);
|
||||||
});
|
});
|
||||||
|
@ -202,6 +202,7 @@ void main() {
|
||||||
4194304,
|
4194304,
|
||||||
8388608,
|
8388608,
|
||||||
16777216,
|
16777216,
|
||||||
|
33554432,
|
||||||
];
|
];
|
||||||
final actual = GitCheckout.values.map((e) => e.value).toList();
|
final actual = GitCheckout.values.map((e) => e.value).toList();
|
||||||
expect(actual, expected);
|
expect(actual, expected);
|
||||||
|
|
|
@ -146,16 +146,16 @@ void main() {
|
||||||
packbuilder.free();
|
packbuilder.free();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('returns hash of packfile', () {
|
test('returns name of packfile', () {
|
||||||
final packbuilder = PackBuilder(repo);
|
final packbuilder = PackBuilder(repo);
|
||||||
final odb = repo.odb;
|
final odb = repo.odb;
|
||||||
|
|
||||||
packbuilder.add(odb.objects[0]);
|
packbuilder.add(odb.objects[0]);
|
||||||
Directory(packDirPath).createSync();
|
Directory(packDirPath).createSync();
|
||||||
|
|
||||||
expect(packbuilder.hash.sha, '0' * 40);
|
expect(packbuilder.name, isEmpty);
|
||||||
packbuilder.write(null);
|
packbuilder.write(null);
|
||||||
expect(packbuilder.hash.sha, isNot('0' * 40));
|
expect(packbuilder.name, isNotEmpty);
|
||||||
|
|
||||||
packbuilder.free();
|
packbuilder.free();
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,6 +19,6 @@ target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)
|
||||||
|
|
||||||
# List of absolute paths to libraries that should be bundled with the plugin
|
# List of absolute paths to libraries that should be bundled with the plugin
|
||||||
set(libgit2dart_bundled_libraries
|
set(libgit2dart_bundled_libraries
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/libgit2-1.3.0.dll"
|
"${CMAKE_CURRENT_SOURCE_DIR}/libgit2-1.4.0.dll"
|
||||||
PARENT_SCOPE
|
PARENT_SCOPE
|
||||||
)
|
)
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue