| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -743,7 +743,20 @@ | |||
| 743 | 743 | "graph": { | |
| 744 | 744 | "functions": { | |
| 745 | 745 | "git_graph_ahead_behind": { | |
| 746 | - "ignore": true | ||
| 746 | + "args": { | ||
| 747 | + "ahead": { | ||
| 748 | + "shouldAlloc": true, | ||
| 749 | + "isReturn": true | ||
| 750 | + }, | ||
| 751 | + "behind": { | ||
| 752 | + "shouldAlloc": true, | ||
| 753 | + "isReturn": true | ||
| 754 | + } | ||
| 755 | + }, | ||
| 756 | + "isAsync": true, | ||
| 757 | + "return": { | ||
| 758 | + "isErrorCode": true | ||
| 759 | + } | ||
| 747 | 760 | } | |
| 748 | 761 | } | |
| 749 | 762 | }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,5 @@ | |||
| 1 | + var isPointer = require("./is_pointer"); | ||
| 2 | + | ||
| 1 | 3 | module.exports = function(fn, argReturnsOnly, isAsync) { | |
| 2 | 4 | var result = []; | |
| 3 | 5 | var args = fn.args || []; | |
@@ -11,6 +13,10 @@ module.exports = function(fn, argReturnsOnly, isAsync) { | |||
| 11 | 13 | ||
| 12 | 14 | return_info.parsedName = isAsync ? "baton->" + return_info.name : return_info.name; | |
| 13 | 15 | return_info.isCppClassIntType = ~['Uint32', 'Int32'].indexOf(return_info.cppClassName); | |
| 16 | + return_info.needsDereference | ||
| 17 | + = isAsync && | ||
| 18 | + return_info.cppClassName == "Number" && | ||
| 19 | + isPointer(return_info.cType); | ||
| 14 | 20 | return_info.parsedClassName = (return_info.cppClassName || '').toLowerCase() + "_t"; | |
| 15 | 21 | return_info.returnNameOrName = return_info.returnName || return_info.name; | |
| 16 | 22 | return_info.jsOrCppClassName = return_info.jsClassName || return_info.cppClassName; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,7 +22,7 @@ | |||
| 22 | 22 | {% if isCppClassIntType %} | |
| 23 | 23 | to = NanNew<{{ cppClassName }}>(({{ parsedClassName }}){{= parsedName =}}); | |
| 24 | 24 | {% else %} | |
| 25 | - to = NanNew<{{ cppClassName }}>({{= parsedName =}}); | ||
| 25 | + to = NanNew<{{ cppClassName }}>({% if needsDereference %}*{% endif %}{{= parsedName =}}); | ||
| 26 | 26 | {% endif %} | |
| 27 | 27 | ||
| 28 | 28 | {% elsif cppClassName == 'External' %} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,31 @@ | |||
| 1 | + var assert = require("assert"); | ||
| 2 | + var path = require("path"); | ||
| 3 | + var local = path.join.bind(path, __dirname); | ||
| 4 | + | ||
| 5 | + describe("Graph", function() { | ||
| 6 | + var NodeGit = require("../../"); | ||
| 7 | + var Repository = NodeGit.Repository; | ||
| 8 | + var Graph = NodeGit.Graph; | ||
| 9 | + | ||
| 10 | + var reposPath = local("../repos/workdir"); | ||
| 11 | + | ||
| 12 | + beforeEach(function() { | ||
| 13 | + var test = this; | ||
| 14 | + | ||
| 15 | + return Repository.open(reposPath) | ||
| 16 | + .then(function(repository) { | ||
| 17 | + test.repository = repository; | ||
| 18 | + }); | ||
| 19 | + }); | ||
| 20 | + | ||
| 21 | + it("can get commits ahead/behind for 2 different commits", function() { | ||
| 22 | + return Graph.aheadBehind( | ||
| 23 | + this.repository, | ||
| 24 | + "32789a79e71fbc9e04d3eff7425e1771eb595150", | ||
| 25 | + "1729c73906bb8467f4095c2f4044083016b4dfde") | ||
| 26 | + .then(function(result) { | ||
| 27 | + assert.equal(result.ahead, 1); | ||
| 28 | + assert.equal(result.behind, 1); | ||
| 29 | + }); | ||
| 30 | + }); | ||
| 31 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments