mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(repository)!: add more aliases for api methods
BREAKING CHANGE: Make repository entry point for most operations
This commit is contained in:
parent
9205a3ad82
commit
3a0fa75929
51 changed files with 1380 additions and 1062 deletions
|
@ -8,16 +8,16 @@ void main() {
|
|||
late Index index;
|
||||
late Directory tmpDir;
|
||||
|
||||
setUp(() async {
|
||||
tmpDir = await setupRepo(Directory('test/assets/testrepo/'));
|
||||
setUp(() {
|
||||
tmpDir = setupRepo(Directory('test/assets/testrepo/'));
|
||||
repo = Repository.open(tmpDir.path);
|
||||
index = repo.index;
|
||||
});
|
||||
|
||||
tearDown(() async {
|
||||
tearDown(() {
|
||||
index.free();
|
||||
repo.free();
|
||||
await tmpDir.delete(recursive: true);
|
||||
tmpDir.deleteSync(recursive: true);
|
||||
});
|
||||
|
||||
group('Index', () {
|
||||
|
@ -156,25 +156,18 @@ void main() {
|
|||
expect(index.find('feature_file'), false);
|
||||
});
|
||||
|
||||
group('read tree', () {
|
||||
const treeSha = 'df2b8fc99e1c1d4dbc0a854d9f72157f1d6ea078';
|
||||
test('successfully reads with provided SHA hex', () {
|
||||
expect(index.length, 4);
|
||||
index.readTree(treeSha);
|
||||
test('successfully reads tree with provided SHA hex', () {
|
||||
final tree = repo.lookupTree(
|
||||
repo['df2b8fc99e1c1d4dbc0a854d9f72157f1d6ea078'],
|
||||
);
|
||||
expect(index.length, 4);
|
||||
index.readTree(tree);
|
||||
|
||||
expect(index.length, 1);
|
||||
expect(index.length, 1);
|
||||
|
||||
// make sure the index is only modified in memory
|
||||
index.read();
|
||||
expect(index.length, 4);
|
||||
});
|
||||
|
||||
test('successfully reads with provided short SHA hex', () {
|
||||
expect(index.length, 4);
|
||||
index.readTree(treeSha.substring(0, 5));
|
||||
|
||||
expect(index.length, 1);
|
||||
});
|
||||
// make sure the index is only modified in memory
|
||||
index.read();
|
||||
expect(index.length, 4);
|
||||
});
|
||||
|
||||
test('successfully writes tree', () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue