feat(repository)!: add more aliases for api methods

BREAKING CHANGE: Make repository entry point for most operations
This commit is contained in:
Aleksey Kulikov 2021-10-11 20:06:36 +03:00
parent 9205a3ad82
commit 3a0fa75929
51 changed files with 1380 additions and 1062 deletions

View file

@ -139,25 +139,9 @@ class Index with IterableMixin<IndexEntry> {
bindings.read(indexPointer: _indexPointer, force: force);
/// Updates the contents of an existing index object in memory by reading from the
/// specified tree.
void readTree(Object target) {
late final Tree tree;
if (target is Oid) {
final repo = Repository(bindings.owner(_indexPointer));
tree = Tree.lookup(repo: repo, sha: target.sha);
} else if (target is Tree) {
tree = target;
} else if (target is String) {
final repo = Repository(bindings.owner(_indexPointer));
tree = Tree.lookup(repo: repo, sha: target);
} else {
throw ArgumentError.value(
'$target should be either Oid object, SHA hex string or Tree object');
}
/// specified [tree].
void readTree(Tree tree) {
bindings.readTree(indexPointer: _indexPointer, treePointer: tree.pointer);
tree.free();
}
/// Writes an existing index object from memory back to disk using an atomic file lock.