| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1679,7 +1679,7 @@ | |||
| 1679 | 1679 | }, | |
| 1680 | 1680 | "isAsync": true, | |
| 1681 | 1681 | "return": { | |
| 1682 | - "isErrorCode": true | ||
| 1682 | + "isResultOrError": true | ||
| 1683 | 1683 | } | |
| 1684 | 1684 | } | |
| 1685 | 1685 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - #include <git2/oid.h> | ||
| 2 | 1 | {% each fields|fieldsInfo as field %} | |
| 3 | 2 | {% if not field.ignore %} | |
| 4 | 3 | {% if field.isCallbackFunction %} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,12 +49,31 @@ | |||
| 49 | 49 | ||
| 50 | 50 | v8::Local<v8::Array> tmp_{{ name }} = v8::Local<v8::Array>::Cast(info[{{ jsArg }}]); | |
| 51 | 51 | from_{{ name }} = ({{ cType }})malloc(tmp_{{ name }}->Length() * sizeof({{ cType|unPointer }})); | |
| 52 | - for (unsigned int i = 0; i < tmp_{{ name }}->Length(); i++) { | ||
| 52 | + for (unsigned int i = 0; i < tmp_{{ name }}->Length(); i++) { | ||
| 53 | 53 | {%-- | |
| 54 | 54 | // FIXME: should recursively call convertFromv8. | |
| 55 | 55 | --%} | |
| 56 | - from_{{ name }}[i] = {%if not cType|isDoublePointer %}*{%endif%}Nan::ObjectWrap::Unwrap<{{ arrayElementCppClassName }}>(Nan::To<v8::Object>(Nan::Get(tmp_{{ name }}, Nan::New(static_cast<double>(i))).ToLocalChecked()).ToLocalChecked())->GetValue(); | ||
| 56 | + const v8::Local<v8::Value> arrayVal = Nan::Get(tmp_{{ name }},i).ToLocalChecked(); | ||
| 57 | + {%if arrayElementCppClassName == 'GitOid'%} | ||
| 58 | + if (arrayVal->IsString()) { | ||
| 59 | + // Try and parse in a string to a git_oid | ||
| 60 | + Nan::Utf8String oidString(Nan::To<v8::String>(arrayVal).ToLocalChecked()); | ||
| 61 | + | ||
| 62 | + if (git_oid_fromstr(&from_{{ name }}[i], (const char *) strdup(*oidString)) != GIT_OK) { | ||
| 63 | + if (git_error_last()) { | ||
| 64 | + return Nan::ThrowError(git_error_last()->message); | ||
| 65 | + } else { | ||
| 66 | + return Nan::ThrowError("Unknown Error"); | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + else { | ||
| 71 | + git_oid_cpy(&from_{{ name }}[i], Nan::ObjectWrap::Unwrap<GitOid>(Nan::To<v8::Object>(arrayVal).ToLocalChecked())->GetValue()); | ||
| 57 | 72 | } | |
| 73 | + {%else%} | ||
| 74 | + from_{{ name }}[i] = Nan::ObjectWrap::Unwrap<{{ arrayElementCppClassName }}>(Nan::To<v8::Object>(arrayVal).ToLocalChecked())->GetValue(); | ||
| 75 | + {%endif%} | ||
| 76 | + } | ||
| 58 | 77 | {%elsif cppClassName == 'Function'%} | |
| 59 | 78 | {%elsif cppClassName == 'Buffer'%} | |
| 60 | 79 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,15 @@ | |||
| 1 | + var NodeGit = require("../"); | ||
| 2 | + | ||
| 3 | + var Graph = NodeGit.Graph; | ||
| 4 | + | ||
| 5 | + var _reachableFromAny = Graph.reachableFromAny; | ||
| 6 | + | ||
| 7 | + /** | ||
| 8 | + * Determine if a commit is reachable from any of a list of commits by following parent edges. | ||
| 9 | + * @param {repository} the repository where the commits exist | ||
| 10 | + * @param {commit} a previously loaded commit | ||
| 11 | + * @param {descendant_array} oids of the commits | ||
| 12 | + */ | ||
| 13 | + Graph.reachableFromAny = function(repository, commit, descendant_array) { | ||
| 14 | + return _reachableFromAny(repository, commit, descendant_array, descendant_array.length); | ||
| 15 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,7 +11,7 @@ function defaultRebaseOptions(repository, options, checkoutStrategy) { | |||
| 11 | 11 | // options object is later re-used. | |
| 12 | 12 | options = Object.assign({}, options); | |
| 13 | 13 | ||
| 14 | - if(options.signingCb && !options.commitCreateCb) { | ||
| 14 | + if (options.signingCb && !options.commitCreateCb) { | ||
| 15 | 15 | console.warn("signingCb is deperecated, use commitCreateCb instead."); | |
| 16 | 16 | ||
| 17 | 17 | let signingCb = options.signingCb; | |
@@ -32,7 +32,6 @@ function defaultRebaseOptions(repository, options, checkoutStrategy) { | |||
| 32 | 32 | tree, | |
| 33 | 33 | parents, | |
| 34 | 34 | signingCb).then((oid) => { | |
| 35 | - console.log(oid.toString()); | ||
| 36 | 35 | return oid; | |
| 37 | 36 | }); | |
| 38 | 37 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -61,4 +61,18 @@ describe("Graph", function() { | |||
| 61 | 61 | assert(~result.message.indexOf("object not found - no match for id")); | |
| 62 | 62 | }); | |
| 63 | 63 | }); | |
| 64 | + | ||
| 65 | + it("can tell if a commit is reachable from any of a list of commits", function() { | ||
| 66 | + return Graph.reachableFromAny( | ||
| 67 | + this.repository, | ||
| 68 | + "32789a79e71fbc9e04d3eff7425e1771eb595150", | ||
| 69 | + [ | ||
| 70 | + "1729c73906bb8467f4095c2f4044083016b4dfde", | ||
| 71 | + "e0aeedcff0584ebe00aed2c03c8ecd10839df908" | ||
| 72 | + ] | ||
| 73 | + ) | ||
| 74 | + .then(function(result) { | ||
| 75 | + assert.equal(result, 0); | ||
| 76 | + }); | ||
| 77 | + }); | ||
| 64 | 78 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2528,7 +2528,6 @@ describe("Rebase", function() { | |||
| 2528 | 2528 | assert.fail("should throw"); | |
| 2529 | 2529 | }) | |
| 2530 | 2530 | .catch((error) => { | |
| 2531 | - console.log(error); | ||
| 2532 | 2531 | assert(error.errno === NodeGit.Error.CODE.ITEROVER); | |
| 2533 | 2532 | assert.strictEqual(rebase.finish(ourSignature), 0); | |
| 2534 | 2533 | return NodeGit.Commit.extractSignature( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments