mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
feat(blame): add binding and api method for git_blame_buffer (#20)
This commit is contained in:
parent
7148fbf194
commit
39a71811cb
3 changed files with 84 additions and 4 deletions
|
@ -88,6 +88,31 @@ void main() {
|
|||
expect(() => repo.blame(path: 'invalid'), throwsA(isA<LibGit2Error>()));
|
||||
});
|
||||
|
||||
test('returns blame for buffer', () {
|
||||
final blame = repo.blame(path: 'feature_file');
|
||||
expect(blame.length, 2);
|
||||
|
||||
final bufferBlame = Blame.buffer(reference: blame, buffer: ' ');
|
||||
final blameHunk = bufferBlame.first;
|
||||
expect(bufferBlame.length, 1);
|
||||
expect(blameHunk.originCommitOid.sha, '0' * 40);
|
||||
expect(blameHunk.originCommitter, null);
|
||||
expect(blameHunk.finalCommitOid.sha, '0' * 40);
|
||||
expect(blameHunk.finalCommitter, null);
|
||||
|
||||
bufferBlame.free();
|
||||
blame.free();
|
||||
});
|
||||
|
||||
test('throws when trying to get blame for empty buffer', () {
|
||||
final blame = repo.blame(path: 'feature_file');
|
||||
expect(
|
||||
() => Blame.buffer(reference: blame, buffer: ''),
|
||||
throwsA(isA<LibGit2Error>()),
|
||||
);
|
||||
blame.free();
|
||||
});
|
||||
|
||||
test(
|
||||
'successfully gets the blame for provided file with '
|
||||
'minMatchCharacters set', () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue