diff --git a/.travis.yml b/.travis.yml
index 891a60818..77d182cb3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,37 +1,49 @@
+sudo: false
+
branches:
only:
- master
- /^v\d+\.\d+\.\d+$/
compiler: clang
+language: node_js
+
+# Stage order; the default stage is "test", which in our case is actually building and deploying
+stages:
+ - "Extended testing"
+ - test
+ - "Deploy documentation"
+
+env:
+ - TARGET_ARCH="x64"
+ - TARGET_ARCH="ia32"
+
+node_js:
+ - "9"
+ - "8"
+ - "6"
os:
- linux
- osx
-sudo: false
-
-env:
- matrix:
- - export NODE_VERSION="9.6" TARGET_ARCH="x64"
- - export NODE_VERSION="8.9" TARGET_ARCH="x64"
- - export NODE_VERSION="7.10" TARGET_ARCH="x64"
- - export NODE_VERSION="6.13" TARGET_ARCH="x64"
-
-matrix:
- fast_finish: true
+jobs:
+ exclude:
+ - os: osx
+ env: TARGET_ARCH="ia32"
include:
- - os: linux
- env: export NODE_VERSION="9.6" TARGET_ARCH="ia32"
- - os: linux
- env: export NODE_VERSION="8.9" TARGET_ARCH="ia32"
- - os: linux
- env: export NODE_VERSION="7.10" TARGET_ARCH="ia32"
- - os: linux
- env: export NODE_VERSION="6.13" TARGET_ARCH="ia32"
+ - stage: "Extended testing"
+ os: linux
+ node_js: "8"
+ env: TARGET_ARCH="x64" EXTENDED_TESTING="false"
+ - stage: "Deploy documentation"
+ os: linux
+ node_js: "8"
+ env: TARGET_ARCH="x64" DEPLOY_DOCUMENTATION="true"
+
git:
- depth: 1
+ depth: 5
addons:
apt:
@@ -50,14 +62,7 @@ before_install:
- export npm_config_clang=1
- export JOBS=4
- - if [ $TRAVIS_OS_NAME != "linux" ]; then
- git clone https://github.com/creationix/nvm.git ./.nvm;
- source ./.nvm/nvm.sh;
- fi
-
- - nvm install $NODE_VERSION
-
- - if [ -z "$TRAVIS_TAG" ] && [ $TRAVIS_OS_NAME == "linux" ] && [ $NODE_VERSION == "6" ]; then
+ - if [ -z "$TRAVIS_TAG" ] && [ "$EXTENDED_TESTING" == "true" ]; then
export GYP_DEFINES="coverage=1 use_obsolete_asm=true";
export CC=/usr/bin/gcc-4.9;
export CXX=/usr/bin/g++-4.9;
@@ -83,7 +88,7 @@ before_script:
- git config --global user.email johndoe@example.com
script:
- if [ -z "$TRAVIS_TAG" ] && [ $TRAVIS_OS_NAME == "linux" ] && [ $NODE_VERSION == "6" ]; then
+ if [ -z "$TRAVIS_TAG" ] && [ "$EXTENDED_TESTING" == "true" ]; then
travis_retry npm test && npm run cov && npm run coveralls;
else
travis_retry npm test;
@@ -98,7 +103,7 @@ after_success:
node-pre-gyp publish --target_arch=$TARGET_ARCH;
fi
- - if [ $TRAVIS_BRANCH == "master" ] && [ $TRAVIS_PULL_REQUEST == "false" ] && [ $TRAVIS_OS_NAME == "linux" ] && [ $NODE_VERSION == "6" ] && [ $TARGET_ARCH == "x64" ]; then
+ - if [ "$TRAVIS_BRANCH" == "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ -n "$TRAVIS_TAG" ] && [ "$DEPLOY_DOCUMENTATION" == "true" ]; then
.travis/deploy-docs.sh;
fi
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 41cf4aa5e..5b21f4837 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,32 @@
# Change Log
+## v0.21.2v0.21.1 [(2018-03-05)](https://github.com/nodegit/nodegit/releases/tag/v0.21.1)
[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.21.0...v0.21.1)
@@ -14,7 +41,7 @@
[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.20.3...v0.21.0)
-### Summary of changes to NodeGit:
+#### Summary of changes to NodeGit:
- [Generate default options for Revert.revert to prevent an exception #1404](https://github.com/nodegit/nodegit/pull/1404)
- [fix issue with re-require()'ing native modules #1354](https://github.com/nodegit/nodegit/pull/1354)
- [Expose JavaScript function name in a rejected promise #1393](https://github.com/nodegit/nodegit/pull/1393)
@@ -29,7 +56,7 @@
- [Fix details-for-tree-entry.js to access fields instead of calling a function #1326](https://github.com/nodegit/nodegit/pull/1326)
- [Add JavaScript version of `git_tag_peel()` #1269](https://github.com/nodegit/nodegit/pull/1269)
- [Fixed documentation error #1417](https://github.com/nodegit/nodegit/pull/1417)
- - [Annoate Blame.file as async #1421](https://github.com/nodegit/nodegit/pull/1421)
+ - [Annotate Blame.file as async #1421](https://github.com/nodegit/nodegit/pull/1421)
- [Add two missing tests to Commit #1422](https://github.com/nodegit/nodegit/pull/1422)
- [CI: Update Node.js versions + some deps #1444](https://github.com/nodegit/nodegit/pull/1444)
- [Expose fetch_options.custom_headers #1430](https://github.com/nodegit/nodegit/pull/1430)
@@ -117,7 +144,7 @@
- [Add CI build config for node stable version #1337](https://github.com/nodegit/nodegit/pull/1337)
- [removed node v4 tests #1330](https://github.com/nodegit/nodegit/pull/1330)
-#### Included merged libgti2 PRs:
+#### Included merged libgit2 PRs:
- [Include fixups #4288](https://github.com/libgit2/libgit2/pull/4288)
- [Docs: Fix inline comments for git_diff_hunk #4330](https://github.com/libgit2/libgit2/pull/4330)
- [oid: use memcmp in git_oid__hashcmp #4328](https://github.com/libgit2/libgit2/pull/4328)
@@ -193,7 +220,7 @@
#### Summary of changes outside of libgit2 bump:
- You can now convert tree entries in blobs [PR #1272](https://github.com/nodegit/nodegit/pull/1272)
-#### Included merged libgti2 PRs:
+#### Included merged libgit2 PRs:
- [fileops: fix leaking fd in `mmap_ro_file` #4201](https://github.com/libgit2/libgit2/pull/4201)
- [README: document our relation to changes in upstream #4198](https://github.com/libgit2/libgit2/pull/4198)
diff --git a/appveyor.yml b/appveyor.yml
index fb0c1a02c..acbc2bcc9 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -28,7 +28,6 @@ environment:
# Node.js
- nodejs_version: "9"
- nodejs_version: "8"
- - nodejs_version: "7"
- nodejs_version: "6"
matrix:
diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json
index 54d611ac0..fde52a83a 100644
--- a/generate/input/descriptor.json
+++ b/generate/input/descriptor.json
@@ -523,7 +523,7 @@
"ignore": true
},
"git_commit_extract_signature": {
- "ignore": true
+ "isAsync": true
},
"git_commit_id": {
"return": {
@@ -576,13 +576,40 @@
"ignore": true
},
"git_config_find_global": {
- "ignore": true
+ "isAsync": true,
+ "args": {
+ "out": {
+ "isReturn": true,
+ "shouldAlloc": true
+ }
+ },
+ "return": {
+ "isErrorCode": true
+ }
},
"git_config_find_system": {
- "ignore": true
+ "isAsync": true,
+ "args": {
+ "out": {
+ "isReturn": true,
+ "shouldAlloc": true
+ }
+ },
+ "return": {
+ "isErrorCode": true
+ }
},
"git_config_find_xdg": {
- "ignore": true
+ "isAsync": true,
+ "args": {
+ "out": {
+ "isReturn": true,
+ "shouldAlloc": true
+ }
+ },
+ "return": {
+ "isErrorCode": true
+ }
},
"git_config_foreach": {
"ignore": true
@@ -627,7 +654,16 @@
}
},
"git_config_get_path": {
- "ignore": true
+ "isAsync": true,
+ "args": {
+ "out": {
+ "isReturn": true,
+ "shouldAlloc": true
+ }
+ },
+ "return": {
+ "isErrorCode": true
+ }
},
"git_config_iterator_free": {
"ignore": true
@@ -666,7 +702,15 @@
"ignore": true
},
"git_config_open_ondisk": {
- "ignore": true
+ "isAsync": true,
+ "return": {
+ "isErrorCode": true
+ },
+ "args": {
+ "out": {
+ "isReturn": true
+ }
+ }
},
"git_config_parse_bool": {
"ignore": true
diff --git a/generate/input/libgit2-supplement.json b/generate/input/libgit2-supplement.json
index 3e0d24fd7..a31e54f2b 100644
--- a/generate/input/libgit2-supplement.json
+++ b/generate/input/libgit2-supplement.json
@@ -86,6 +86,40 @@
},
"new" : {
"functions": {
+ "git_commit_extract_signature": {
+ "args": [
+ {
+ "name": "signature",
+ "type": "git_buf"
+ },
+ {
+ "name": "signed_data",
+ "type": "git_buf"
+ },
+ {
+ "name": "repo",
+ "type": "git_repository *"
+ },
+ {
+ "name": "commit_id",
+ "type": "git_oid *"
+ },
+ {
+ "name": "field",
+ "type": "char *"
+ }
+ ],
+ "type": "function",
+ "isManual": true,
+ "cFile": "generate/templates/manual/commit/extract_signature.cc",
+ "isAsync": true,
+ "isPrototypeMethod": false,
+ "group": "commit",
+ "return": {
+ "type": "int",
+ "isErrorCode": true
+ }
+ },
"git_patch_convenient_from_diff": {
"args": [
{
diff --git a/generate/templates/manual/commit/extract_signature.cc b/generate/templates/manual/commit/extract_signature.cc
new file mode 100644
index 000000000..581eef6b8
--- /dev/null
+++ b/generate/templates/manual/commit/extract_signature.cc
@@ -0,0 +1,156 @@
+NAN_METHOD(GitCommit::ExtractSignature)
+{
+ if (info.Length() == 0 || !info[0]->IsObject()) {
+ return Nan::ThrowError("Repository repo is required.");
+ }
+
+ if (info.Length() == 1 || (!info[1]->IsObject() && !info[1]->IsString())) {
+ return Nan::ThrowError("Oid commit_id is required.");
+ }
+
+ if (info.Length() == 2 || (info.Length() == 3 && !info[2]->IsFunction())) {
+ return Nan::ThrowError("Callback is required and must be a Function.");
+ }
+
+ if (info.Length() >= 4) {
+ if (!info[2]->IsString() && !info[2]->IsUndefined() && !info[2]->IsNull()) {
+ return Nan::ThrowError("String signature_field must be a string or undefined/null.");
+ }
+
+ if (!info[3]->IsFunction()) {
+ return Nan::ThrowError("Callback is required and must be a Function.");
+ }
+ }
+
+ ExtractSignatureBaton* baton = new ExtractSignatureBaton;
+
+ baton->error_code = GIT_OK;
+ baton->error = NULL;
+ baton->signature = GIT_BUF_INIT_CONST(NULL, 0);
+ baton->signed_data = GIT_BUF_INIT_CONST(NULL, 0);
+ baton->repo = Nan::ObjectWrap::Unwrap(info[0]->ToObject())->GetValue();
+
+ // baton->commit_id
+ if (info[1]->IsString()) {
+ String::Utf8Value oidString(info[1]->ToString());
+ baton->commit_id = (git_oid *)malloc(sizeof(git_oid));
+ if (git_oid_fromstr(baton->commit_id, (const char *)strdup(*oidString)) != GIT_OK) {
+ free(baton->commit_id);
+
+ if (giterr_last()) {
+ return Nan::ThrowError(giterr_last()->message);
+ } else {
+ return Nan::ThrowError("Unknown Error");
+ }
+ }
+ } else {
+ baton->commit_id = Nan::ObjectWrap::Unwrap(info[1]->ToObject())->GetValue();
+ }
+
+ // baton->field
+ if (info[2]->IsString()) {
+ String::Utf8Value field(info[2]->ToString());
+ baton->field = (char *)malloc(field.length() + 1);
+ memcpy((void *)baton->field, *field, field.length());
+ baton->field[field.length()] = 0;
+ } else {
+ baton->field = NULL;
+ }
+
+ Nan::Callback *callback;
+ if (info[2]->IsFunction()) {
+ callback = new Nan::Callback(Local::Cast(info[2]));
+ } else {
+ callback = new Nan::Callback(Local::Cast(info[3]));
+ }
+
+ ExtractSignatureWorker *worker = new ExtractSignatureWorker(baton, callback);
+ worker->SaveToPersistent("repo", info[0]->ToObject());
+ worker->SaveToPersistent("commit_id", info[1]->ToObject());
+ Nan::AsyncQueueWorker(worker);
+ return;
+}
+
+void GitCommit::ExtractSignatureWorker::Execute()
+{
+ giterr_clear();
+
+ {
+ LockMaster lockMaster(
+ /*asyncAction: */true,
+ baton->repo
+ );
+
+ baton->error_code = git_commit_extract_signature(
+ &baton->signature,
+ &baton->signed_data,
+ baton->repo,
+ baton->commit_id,
+ (const char *)baton->field
+ );
+
+ if (baton->error_code != GIT_OK && giterr_last() != NULL) {
+ baton->error = git_error_dup(giterr_last());
+ }
+ }
+}
+
+void GitCommit::ExtractSignatureWorker::HandleOKCallback()
+{
+ if (baton->error_code == GIT_OK)
+ {
+ Local result = Nan::New