add name_to_id binding and headCommit to repo

- implemented git_reference_name_to_id binding
- created repository.headCommit getter
This commit is contained in:
Viktor Borisov 2023-02-25 02:43:34 +07:00
parent b66662f33c
commit 35afc87b58
5 changed files with 58 additions and 0 deletions

View file

@ -530,6 +530,11 @@ void main() {
);
});
test('get oid by name', () {
final oid = Reference.nameToId(repo: repo, refName: 'HEAD');
expect(oid, repo.head.target);
});
test('manually releases allocated memory', () {
final ref = Reference.lookup(repo: repo, name: 'refs/heads/master');
expect(() => ref.free(), returnsNormally);

View file

@ -246,6 +246,10 @@ void main() {
expect(() => repo.free(), returnsNormally);
});
test('get head commit', () {
expect(repo.headCommit.oid.sha, lastCommit);
});
test('returns string representation of Repository object', () {
expect(repo.toString(), contains('Repository{'));
});