Skip to content

Commit 2cef5b5

Browse files
committed
Fix note tests
1 parent fab9237 commit 2cef5b5

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/note.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,12 @@ var Note = NodeGit.Note;
55
// Override Note.foreach to eliminate the need to pass null payload
66
var foreach = Note.foreach;
77
Note.foreach = function(repo, notesRef, callback) {
8-
return foreach(repo, notesRef, callback, null);
8+
function wrapperCallback(blobId, objectId) {
9+
// We need to copy the OID since libgit2 types are getting cleaned up
10+
// incorrectly right now in callbacks
11+
12+
return callback(blobId.copy(), objectId.copy());
13+
}
14+
15+
return foreach(repo, notesRef, wrapperCallback, null);
916
};

0 commit comments

Comments
 (0)