| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -273,7 +273,11 @@ | |||
| 273 | 273 | "git_note_foreach_cb": { | |
| 274 | 274 | "args": [ | |
| 275 | 275 | { | |
| 276 | - "name": "id", | ||
| 276 | + "name": "blob_id", | ||
| 277 | + "cType": "const git_oid *" | ||
| 278 | + }, | ||
| 279 | + { | ||
| 280 | + "name": "annotated_object_id", | ||
| 277 | 281 | "cType": "const git_oid *" | |
| 278 | 282 | }, | |
| 279 | 283 | { | |
@@ -283,7 +287,7 @@ | |||
| 283 | 287 | ], | |
| 284 | 288 | "return": { | |
| 285 | 289 | "type": "int", | |
| 286 | - "noResults": 1, | ||
| 290 | + "noResults": 0, | ||
| 287 | 291 | "success": 0, | |
| 288 | 292 | "error": -1 | |
| 289 | 293 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -944,8 +944,17 @@ | |||
| 944 | 944 | } | |
| 945 | 945 | } | |
| 946 | 946 | }, | |
| 947 | + "git_note_remove": { | ||
| 948 | + "isAsync": true, | ||
| 949 | + "return": { | ||
| 950 | + "isErrorCode": true | ||
| 951 | + } | ||
| 952 | + }, | ||
| 947 | 953 | "git_note_foreach": { | |
| 948 | - "ignore": true | ||
| 954 | + "isAsync": true, | ||
| 955 | + "return": { | ||
| 956 | + "isErrorCode": true | ||
| 957 | + } | ||
| 949 | 958 | } | |
| 950 | 959 | } | |
| 951 | 960 | }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,9 @@ | |||
| 1 | + var NodeGit = require("../"); | ||
| 2 | + | ||
| 3 | + var Note = NodeGit.Note; | ||
| 4 | + | ||
| 5 | + // Override Note.foreach to eliminate the need to pass null payload | ||
| 6 | + var foreach = Note.foreach; | ||
| 7 | + Note.foreach = function(repo, notesRef, callback) { | ||
| 8 | + return foreach(repo, notesRef, callback, null); | ||
| 9 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,7 @@ describe("Note", function() { | |||
| 6 | 6 | var NodeGit = require("../../"); | |
| 7 | 7 | var Note = NodeGit.Note; | |
| 8 | 8 | var Signature = NodeGit.Signature; | |
| 9 | - var reposPath = local("../repos/merge"); | ||
| 9 | + var reposPath = local("../../"); | ||
| 10 | 10 | ||
| 11 | 11 | beforeEach(function() { | |
| 12 | 12 | var test = this; | |
@@ -37,16 +37,33 @@ describe("Note", function() { | |||
| 37 | 37 | }); | |
| 38 | 38 | }); | |
| 39 | 39 | ||
| 40 | + it("can iterate all notes", function() { | ||
| 41 | + var test = this; | ||
| 42 | + var noteRef = "refs/notes/commits"; | ||
| 43 | + var ref = null; | ||
| 44 | + | ||
| 45 | + return Note.foreach(this.repository, noteRef, function(blobId, objectId) { | ||
| 46 | + ref = objectId; | ||
| 47 | + }).then(function() { | ||
| 48 | + return NodeGit.Note.read(test.repository, noteRef, ref) | ||
| 49 | + .then(function(note) { | ||
| 50 | + assert.equal(note.message(), "Testing!"); | ||
| 51 | + }); | ||
| 52 | + }); | ||
| 53 | + }); | ||
| 54 | + | ||
| 40 | 55 | it("can be removed", function(done) { | |
| 56 | + var test = this; | ||
| 41 | 57 | var sha = this.commit.id(); | |
| 42 | 58 | var noteRef = "refs/notes/commits"; | |
| 43 | 59 | var sig = Signature.create("John", "john@doe.com", Date.now(), 0); | |
| 44 | 60 | ||
| 45 | - Note.remove(this.repository, noteRef, sig, sig, sha); | ||
| 46 | - | ||
| 47 | - return Note.read(this.repository, noteRef, sha).catch(function(ex) { | ||
| 48 | - assert.equal(ex.message, "Note could not be found"); | ||
| 49 | - done(); | ||
| 50 | - }); | ||
| 61 | + return Note.remove(this.repository, noteRef, sig, sig, sha) | ||
| 62 | + .then(function() { | ||
| 63 | + return Note.read(test.repository, noteRef, sha).catch(function(ex) { | ||
| 64 | + assert.equal(ex.message, "Note could not be found"); | ||
| 65 | + done(); | ||
| 66 | + }); | ||
| 67 | + }); | ||
| 51 | 68 | }); | |
| 52 | 69 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments