feat(reflog): add more bindings and API methods (#29)

This commit is contained in:
Aleksey Kulikov 2021-12-23 10:58:44 +03:00 committed by GitHub
parent ff2dd8b408
commit fda5173e7f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 305 additions and 12 deletions

View file

@ -128,6 +128,31 @@ void main() {
ref.free();
});
test('ensures updates to the reference will append to its log', () {
Reference.ensureLog(repo: repo, refName: 'refs/tags/tag');
final ref = repo.createReference(
name: 'refs/tags/tag',
target: repo[lastCommit],
);
final reflog = ref.log;
expect(reflog.length, 1);
reflog.free();
ref.free();
});
test('throws when trying to ensure there is a reflog and error occurs', () {
expect(
() => Reference.ensureLog(
repo: Repository(nullptr),
refName: 'refs/tags/tag',
),
throwsA(isA<LibGit2Error>()),
);
});
test('duplicates existing reference', () {
expect(repo.references.length, 6);