| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -371,9 +371,9 @@ | |||
| 371 | 371 | ], | |
| 372 | 372 | "return": { | |
| 373 | 373 | "type": "int", | |
| 374 | - "noResults": 1, | ||
| 374 | + "noResults": 0, | ||
| 375 | 375 | "success": 0, | |
| 376 | - "error": -1 | ||
| 376 | + "error": 1 | ||
| 377 | 377 | } | |
| 378 | 378 | }, | |
| 379 | 379 | "git_repository_mergehead_foreach_cb": { | |
@@ -389,9 +389,9 @@ | |||
| 389 | 389 | ], | |
| 390 | 390 | "return": { | |
| 391 | 391 | "type": "int", | |
| 392 | - "noResults": 1, | ||
| 392 | + "noResults": 0, | ||
| 393 | 393 | "success": 0, | |
| 394 | - "error": -1 | ||
| 394 | + "error": 1 | ||
| 395 | 395 | } | |
| 396 | 396 | }, | |
| 397 | 397 | "git_revwalk_hide_cb": { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1456,7 +1456,10 @@ | |||
| 1456 | 1456 | "ignore": true | |
| 1457 | 1457 | }, | |
| 1458 | 1458 | "git_repository_fetchhead_foreach": { | |
| 1459 | - "ignore": true | ||
| 1459 | + "isAsync": true, | ||
| 1460 | + "return": { | ||
| 1461 | + "isErrorCode": true | ||
| 1462 | + } | ||
| 1460 | 1463 | }, | |
| 1461 | 1464 | "git_repository_hashfile": { | |
| 1462 | 1465 | "ignore": true | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -843,4 +843,14 @@ Repository.prototype.checkoutBranch = function(branch, opts) { | |||
| 843 | 843 | }); | |
| 844 | 844 | }; | |
| 845 | 845 | ||
| 846 | + var fetchheadForeach = Repository.prototype.fetchheadForeach; | ||
| 847 | + /** | ||
| 848 | + * @async | ||
| 849 | + * @param {FetchheadForeachCb} callback The callback function to be called on | ||
| 850 | + * each entry | ||
| 851 | + */ | ||
| 852 | + Repository.prototype.fetchheadForeach = function(callback) { | ||
| 853 | + return fetchheadForeach.call(this, callback, null); | ||
| 854 | + }; | ||
| 855 | + | ||
| 846 | 856 | module.exports = Repository; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,7 +55,9 @@ beforeEach(function() { | |||
| 55 | 55 | ||
| 56 | 56 | afterEach(function(done) { | |
| 57 | 57 | process.nextTick(function() { | |
| 58 | - global.gc(); | ||
| 58 | + if (global.gc) { | ||
| 59 | + global.gc(); | ||
| 60 | + } | ||
| 59 | 61 | done(); | |
| 60 | 62 | }); | |
| 61 | 63 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -137,4 +137,36 @@ describe("Repository", function() { | |||
| 137 | 137 | }); | |
| 138 | 138 | }); | |
| 139 | 139 | }); | |
| 140 | + | ||
| 141 | + it("gets fetch-heads", function() { | ||
| 142 | + var repo = this.repository; | ||
| 143 | + var foundMaster; | ||
| 144 | + | ||
| 145 | + return repo.fetch("origin", { | ||
| 146 | + credentials: function(url, userName) { | ||
| 147 | + return NodeGit.Cred.sshKeyFromAgent(userName); | ||
| 148 | + }, | ||
| 149 | + certificateCheck: function() { | ||
| 150 | + return 1; | ||
| 151 | + } | ||
| 152 | + }) | ||
| 153 | + .then(function() { | ||
| 154 | + return repo.fetchheadForeach(function(refname, remoteUrl, oid, isMerge) { | ||
| 155 | + if (refname == "refs/heads/master") { | ||
| 156 | + foundMaster = true; | ||
| 157 | + assert.equal(refname, "refs/heads/master"); | ||
| 158 | + assert.equal(remoteUrl, "https://github.com/nodegit/test"); | ||
| 159 | + assert.equal( | ||
| 160 | + oid.toString(), | ||
| 161 | + "32789a79e71fbc9e04d3eff7425e1771eb595150"); | ||
| 162 | + assert.equal(isMerge, 1); | ||
| 163 | + } | ||
| 164 | + }); | ||
| 165 | + }) | ||
| 166 | + .then(function() { | ||
| 167 | + if (!foundMaster) { | ||
| 168 | + throw new Error("Couldn't find master in iteration of fetch heads"); | ||
| 169 | + } | ||
| 170 | + }); | ||
| 171 | + }); | ||
| 140 | 172 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments