mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat: upgrade libgit2 to 1.4.0 (#45)
This commit is contained in:
parent
7a067beeb9
commit
d901d2e13f
16 changed files with 747 additions and 287 deletions
|
@ -95,25 +95,29 @@ void main() {
|
|||
);
|
||||
});
|
||||
|
||||
test('clones repository with provided keypair', () {
|
||||
final keypair = Keypair(
|
||||
username: 'git',
|
||||
pubKey: p.join('test', 'assets', 'keys', 'id_rsa.pub'),
|
||||
privateKey: p.join('test', 'assets', 'keys', 'id_rsa'),
|
||||
passPhrase: 'empty',
|
||||
);
|
||||
final callbacks = Callbacks(credentials: keypair);
|
||||
test(
|
||||
'clones repository with provided keypair',
|
||||
() {
|
||||
final keypair = Keypair(
|
||||
username: 'git',
|
||||
pubKey: p.join('test', 'assets', 'keys', 'id_rsa.pub'),
|
||||
privateKey: p.join('test', 'assets', 'keys', 'id_rsa'),
|
||||
passPhrase: 'empty',
|
||||
);
|
||||
final callbacks = Callbacks(credentials: keypair);
|
||||
|
||||
final repo = Repository.clone(
|
||||
url: 'https://github.com/libgit2/TestGitRepository',
|
||||
localPath: cloneDir.path,
|
||||
callbacks: callbacks,
|
||||
);
|
||||
final repo = Repository.clone(
|
||||
url: 'ssh://git@github.com/libgit2/TestGitRepository',
|
||||
localPath: cloneDir.path,
|
||||
callbacks: callbacks,
|
||||
);
|
||||
|
||||
expect(repo.isEmpty, false);
|
||||
expect(repo.isEmpty, false);
|
||||
|
||||
repo.free();
|
||||
});
|
||||
repo.free();
|
||||
},
|
||||
testOn: '!linux',
|
||||
);
|
||||
|
||||
test('throws when no credentials is provided', () {
|
||||
expect(
|
||||
|
@ -181,29 +185,33 @@ void main() {
|
|||
);
|
||||
});
|
||||
|
||||
test('clones repository with provided keypair from memory', () {
|
||||
final pubKey = File(p.join('test', 'assets', 'keys', 'id_rsa.pub'))
|
||||
.readAsStringSync();
|
||||
final privateKey =
|
||||
File(p.join('test', 'assets', 'keys', 'id_rsa')).readAsStringSync();
|
||||
final keypair = KeypairFromMemory(
|
||||
username: 'git',
|
||||
pubKey: pubKey,
|
||||
privateKey: privateKey,
|
||||
passPhrase: 'empty',
|
||||
);
|
||||
final callbacks = Callbacks(credentials: keypair);
|
||||
test(
|
||||
'clones repository with provided keypair from memory',
|
||||
() {
|
||||
final pubKey = File(p.join('test', 'assets', 'keys', 'id_rsa.pub'))
|
||||
.readAsStringSync();
|
||||
final privateKey =
|
||||
File(p.join('test', 'assets', 'keys', 'id_rsa')).readAsStringSync();
|
||||
final keypair = KeypairFromMemory(
|
||||
username: 'git',
|
||||
pubKey: pubKey,
|
||||
privateKey: privateKey,
|
||||
passPhrase: 'empty',
|
||||
);
|
||||
final callbacks = Callbacks(credentials: keypair);
|
||||
|
||||
final repo = Repository.clone(
|
||||
url: 'https://github.com/libgit2/TestGitRepository',
|
||||
localPath: cloneDir.path,
|
||||
callbacks: callbacks,
|
||||
);
|
||||
final repo = Repository.clone(
|
||||
url: 'ssh://git@github.com/libgit2/TestGitRepository',
|
||||
localPath: cloneDir.path,
|
||||
callbacks: callbacks,
|
||||
);
|
||||
|
||||
expect(repo.isEmpty, false);
|
||||
expect(repo.isEmpty, false);
|
||||
|
||||
repo.free();
|
||||
});
|
||||
repo.free();
|
||||
},
|
||||
testOn: '!linux',
|
||||
);
|
||||
|
||||
test('throws when provided keypair from memory is incorrect', () {
|
||||
final pubKey = File(p.join('test', 'assets', 'keys', 'id_rsa.pub'))
|
||||
|
|
|
@ -165,7 +165,7 @@ void main() {
|
|||
|
||||
group('GitMergeFileFlag', () {
|
||||
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();
|
||||
expect(actual, expected);
|
||||
});
|
||||
|
@ -202,6 +202,7 @@ void main() {
|
|||
4194304,
|
||||
8388608,
|
||||
16777216,
|
||||
33554432,
|
||||
];
|
||||
final actual = GitCheckout.values.map((e) => e.value).toList();
|
||||
expect(actual, expected);
|
||||
|
|
|
@ -146,16 +146,16 @@ void main() {
|
|||
packbuilder.free();
|
||||
});
|
||||
|
||||
test('returns hash of packfile', () {
|
||||
test('returns name of packfile', () {
|
||||
final packbuilder = PackBuilder(repo);
|
||||
final odb = repo.odb;
|
||||
|
||||
packbuilder.add(odb.objects[0]);
|
||||
Directory(packDirPath).createSync();
|
||||
|
||||
expect(packbuilder.hash.sha, '0' * 40);
|
||||
expect(packbuilder.name, isEmpty);
|
||||
packbuilder.write(null);
|
||||
expect(packbuilder.hash.sha, isNot('0' * 40));
|
||||
expect(packbuilder.name, isNotEmpty);
|
||||
|
||||
packbuilder.free();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue