feat(reference): add ability to get shorthand name of reference

This commit is contained in:
Aleksey Kulikov 2021-08-06 17:17:45 +03:00
parent 371d52b7f8
commit a1884b4dac
3 changed files with 30 additions and 1 deletions

View file

@ -272,11 +272,25 @@ void main() {
ref.free();
});
test('returns the full name of a reference', () {
test('returns the full name', () {
expect(repo.head.name, 'refs/heads/master');
repo.head.free();
});
test('returns the short name', () {
final ref = repo.createReference(
name: 'refs/remotes/origin/master',
target: lastCommit,
);
expect(repo.head.shorthand, 'master');
expect(ref.shorthand, 'origin/master');
repo.head.free();
ref.delete();
ref.free();
});
test('returns a map with all the references of repository', () {
expect(
repo.references,