mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 12:19:09 -04:00
feat(reference): add base bindings and api
This commit is contained in:
parent
145af3054d
commit
5f60a693d3
8 changed files with 413 additions and 6 deletions
14
example/reference_example.dart
Normal file
14
example/reference_example.dart
Normal file
|
@ -0,0 +1,14 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:libgit2dart/libgit2dart.dart';
|
||||
|
||||
void main() {
|
||||
final repo = Repository.open(Directory.current.path);
|
||||
final ref = Reference.lookup(repo, 'refs/heads/master');
|
||||
|
||||
print('Reference SHA hex: ${ref.target}');
|
||||
print('Is reference a local branch: ${ref.isBranch}');
|
||||
print('Reference full name: ${ref.name}');
|
||||
|
||||
ref.free();
|
||||
}
|
|
@ -11,11 +11,7 @@ void main() {
|
|||
print('Is repository bare: ${repo.isBare}');
|
||||
print('Is repository empty: ${repo.isEmpty}');
|
||||
print('Is head detached: ${repo.isHeadDetached}');
|
||||
try {
|
||||
print('Prepared message: ${repo.message}');
|
||||
} catch (e) {
|
||||
print('Prepared message: $e');
|
||||
}
|
||||
print('Repository refs: ${repo.references}');
|
||||
|
||||
// close() should be called on object to free memory when done.
|
||||
repo.close();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue