mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(repository): add ability to check status of repo and single file
This commit is contained in:
parent
db21f2e890
commit
1f2d00b177
4 changed files with 171 additions and 7 deletions
|
@ -337,6 +337,31 @@ void main() {
|
|||
newTagTarget.free();
|
||||
signature.free();
|
||||
});
|
||||
|
||||
test('returns status of a repository', () {
|
||||
File('${tmpDir}new_file.txt').createSync();
|
||||
final index = repo.index;
|
||||
index.remove('file');
|
||||
index.add('new_file.txt');
|
||||
expect(repo.status, {'file': 132, 'new_file.txt': 1});
|
||||
|
||||
index.free();
|
||||
});
|
||||
|
||||
test('returns status of a single file for provided path', () {
|
||||
final index = repo.index;
|
||||
index.remove('file');
|
||||
expect(repo.statusFile('file'), 132);
|
||||
|
||||
index.free();
|
||||
});
|
||||
|
||||
test('throws when checking status of a single file for invalid path', () {
|
||||
expect(
|
||||
() => repo.statusFile('not-there'),
|
||||
throwsA(isA<LibGit2Error>()),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue