mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(reference): add ability to get log of reference
This commit is contained in:
parent
a97dcaa0d3
commit
58fa54f24a
5 changed files with 30 additions and 7 deletions
|
@ -2,6 +2,7 @@ import 'dart:ffi';
|
|||
import 'bindings/libgit2_bindings.dart';
|
||||
import 'bindings/reference.dart' as bindings;
|
||||
import 'oid.dart';
|
||||
import 'reflog.dart';
|
||||
import 'util.dart';
|
||||
|
||||
enum ReferenceType { direct, symbolic }
|
||||
|
@ -145,6 +146,18 @@ class Reference {
|
|||
return bindings.hasLog(repo, name);
|
||||
}
|
||||
|
||||
/// Returns a list with entries of reference log.
|
||||
List<RefLogEntry> get log {
|
||||
final reflog = RefLog(this);
|
||||
var log = <RefLogEntry>[];
|
||||
|
||||
for (var i = 0; i < reflog.count; i++) {
|
||||
log.add(reflog.entryAt(i));
|
||||
}
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
/// Checks if a reference is a local branch.
|
||||
bool get isBranch => bindings.isBranch(_refPointer);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue