diff --git a/CHANGELOG.md b/CHANGELOG.md
index b01501353..7bc26bc09 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,68 @@
# Change Log
+## v0.20.3 [(2017-10-18)](https://github.com/nodegit/nodegit/releases/tag/v0.20.3)
+
+[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.20.2...v0.20.3)
+
+#### Summary of changes outside of libgit2 bump:
+ - [Bumped libgit to libgit-next head #1387](https://github.com/nodegit/nodegit/pull/1387)
+ - [Added a better normalizeOptions pattern for the submodule update routine #1388](https://github.com/nodegit/nodegit/pull/1388)
+ - [Updated input docs to allow for git_push_update_reference_cb to generate #1386](https://github.com/nodegit/nodegit/pull/1386)
+ - [Updated descriptors for git_index_find and git_index_find_prefix #1391](https://github.com/nodegit/nodegit/pull/1391)
+
+#### Included merged libgti2 PRs:
+ - [Fix template dir empty string #4273](https://github.com/libgit2/libgit2/pull/4273)
+ - [travis: upgrade container to Ubuntu 14.04 #4211](https://github.com/libgit2/libgit2/pull/4211)
+ - [merge: perform exact rename detection in linear time #4202](https://github.com/libgit2/libgit2/pull/4202)
+ - [merge: fix potential free of uninitialized memory #4277](https://github.com/libgit2/libgit2/pull/4277)
+ - [cmake: Permit disabling external http-parser #4278](https://github.com/libgit2/libgit2/pull/4278)
+ - [Out of tree builds #4235](https://github.com/libgit2/libgit2/pull/4235)
+ - [Convert port with htons() in p_getaddrinfo() #4280](https://github.com/libgit2/libgit2/pull/4280)
+ - [tests: config: fix missing declaration causing error #4291](https://github.com/libgit2/libgit2/pull/4291)
+ - [git_reset_*: pass parameters as const pointers #4287](https://github.com/libgit2/libgit2/pull/4287)
+ - [signature: don't leave a dangling pointer to the strings on parse failure #4306](https://github.com/libgit2/libgit2/pull/4306)
+ - [Patch ID calculation #4272](https://github.com/libgit2/libgit2/pull/4272)
+ - [Configuration file fixes with includes #4250](https://github.com/libgit2/libgit2/pull/4250)
+ - [win32: provide fast-path for retrying filesystem operations #4311](https://github.com/libgit2/libgit2/pull/4311)
+ - [Build with patched libcurl #4317](https://github.com/libgit2/libgit2/pull/4317)
+ - [tsort: remove idempotent conditional assignment #4314](https://github.com/libgit2/libgit2/pull/4314)
+ - [tests: rebase::submodule: verify initialization method calls #4320](https://github.com/libgit2/libgit2/pull/4320)
+ - [Remove unused 'sys/remote.h' header #4323](https://github.com/libgit2/libgit2/pull/4323)
+ - [patch_generate: represent buffers as void pointers #4304](https://github.com/libgit2/libgit2/pull/4304)
+ - [sha1_position: convert do-while to while #4326](https://github.com/libgit2/libgit2/pull/4326)
+ - [sha1_lookup: drop sha1_entry_pos function #4327](https://github.com/libgit2/libgit2/pull/4327)
+ - [oid: use memcmp in git_oid__hashcmp #4328](https://github.com/libgit2/libgit2/pull/4328)
+ - [Docs: Fix inline comments for git_diff_hunk #4330](https://github.com/libgit2/libgit2/pull/4330)
+ - [Split up CMakeLists.txt build instructions #4282](https://github.com/libgit2/libgit2/pull/4282)
+ - [-Werror builds for Travis #4279](https://github.com/libgit2/libgit2/pull/4279)
+ - [Submodules with bare repo #4305](https://github.com/libgit2/libgit2/pull/4305)
+ - [Fix negative ignore rules with patterns #4296](https://github.com/libgit2/libgit2/pull/4296)
+ - [README: Mention Guile-Git bindings. #4342](https://github.com/libgit2/libgit2/pull/4342)
+ - [features.h: allow building without CMake-generated feature header #4346](https://github.com/libgit2/libgit2/pull/4346)
+ - [Clear the remote_ref_name buffer in git_push_update_tips() #4344](https://github.com/libgit2/libgit2/pull/4344)
+ - [Fix AppVeyor build failures due to CRTDBG linking issue #4347](https://github.com/libgit2/libgit2/pull/4347)
+ - [diff: cleanup hash ctx in `git_diff_patchid` #4348](https://github.com/libgit2/libgit2/pull/4348)
+ - [Reproducible builds #4334](https://github.com/libgit2/libgit2/pull/4334)
+ - [Static linking for bundled deps #4339](https://github.com/libgit2/libgit2/pull/4339)
+ - [Use SOCK_CLOEXEC when creating sockets #4364](https://github.com/libgit2/libgit2/pull/4364)
+ - [Document that a commit is not a descendant of itself #4362](https://github.com/libgit2/libgit2/pull/4362)
+ - [refs: do not use peeled OID if peeling to a tag #4367](https://github.com/libgit2/libgit2/pull/4367)
+ - [remote: add typedef to normalize push_update_reference callback #4363](https://github.com/libgit2/libgit2/pull/4363)
+ - [travis: add custom apt sources #4321](https://github.com/libgit2/libgit2/pull/4321)
+ - [Fix Issue #4047 Check return codes and free objects #4370](https://github.com/libgit2/libgit2/pull/4370)
+ - [Plug some leaks in curl's proxy handling #4359](https://github.com/libgit2/libgit2/pull/4359)
+ - [Checkout typechange-only deltas #4369](https://github.com/libgit2/libgit2/pull/4369)
+ - [tests: checkout::tree: verify status entrycount changes on chmod #4371](https://github.com/libgit2/libgit2/pull/4371)
+ - [transports: smart: fix memory leak when skipping symbolic refs #4368](https://github.com/libgit2/libgit2/pull/4368)
+ - [cmake: fix linking in Xcode with object libraries only #4372](https://github.com/libgit2/libgit2/pull/4372)
+ - [cmake: use static dependencies when building static libgit2 #4356](https://github.com/libgit2/libgit2/pull/4356)
+
+#### Included non-merged libgit2 PRs:
+ - [Parallelize checkout_create_the_new for ntfs perf gains #4205](https://github.com/libgit2/libgit2/pull/4205)
+ - [negotiate always fails via libcurl #4126](https://github.com/libgit2/libgit2/pull/4126)
+
+
+
## v0.20.2 [(2017-08-16)](https://github.com/nodegit/nodegit/releases/tag/v0.20.2)
[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.20.0...v0.20.2)
diff --git a/generate/input/callbacks.json b/generate/input/callbacks.json
index 5fe947aa5..215dc5ed9 100644
--- a/generate/input/callbacks.json
+++ b/generate/input/callbacks.json
@@ -908,5 +908,27 @@
"success": 0,
"error": -1
}
+ },
+ "git_push_update_reference_cb": {
+ "args": [
+ {
+ "name": "refname",
+ "cType": "const char *"
+ },
+ {
+ "name": "status",
+ "cType": "const char *"
+ },
+ {
+ "name": "data",
+ "cType": "void *"
+ }
+ ],
+ "return": {
+ "type": "int",
+ "noResults": 1,
+ "success": 0,
+ "error": -1
+ }
}
}
diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json
index c7ceafe73..25a01481d 100644
--- a/generate/input/descriptor.json
+++ b/generate/input/descriptor.json
@@ -1213,7 +1213,28 @@
"jsFunctionName": "entryCount"
},
"git_index_find": {
- "ignore": true
+ "isAsync": true,
+ "args": {
+ "at_pos": {
+ "isReturn": true,
+ "shouldAlloc": true
+ }
+ },
+ "return": {
+ "isErrorCode": true
+ }
+ },
+ "git_index_find_prefix": {
+ "isAsync": true,
+ "args": {
+ "at_pos": {
+ "isReturn": true,
+ "shouldAlloc": true
+ }
+ },
+ "return": {
+ "isErrorCode": true
+ }
},
"git_index_free": {
"ignore": true
@@ -2137,9 +2158,6 @@
"push_transfer_progress": {
"ignore": true
},
- "push_update_reference": {
- "ignore": true
- },
"sideband_progress": {
"ignore": true
},
diff --git a/generate/input/libgit2-supplement.json b/generate/input/libgit2-supplement.json
index 12cfe7b2a..78ecb8ad7 100644
--- a/generate/input/libgit2-supplement.json
+++ b/generate/input/libgit2-supplement.json
@@ -631,6 +631,10 @@
"name": "transport",
"ignore": true
},
+ {
+ "type": "git_push_update_reference_cb",
+ "name": "push_update_reference"
+ },
{
"type": "void *",
"name": "payload"
diff --git a/lib/submodule.js b/lib/submodule.js
index 534fb2c9c..92b0e6ec0 100644
--- a/lib/submodule.js
+++ b/lib/submodule.js
@@ -23,17 +23,28 @@ Submodule.foreach = function(repo, callback) {
* @return {Number} 0 on success, any non-zero return value from a callback
*/
Submodule.prototype.update = function(init, options) {
- var fetchOpts = normalizeFetchOptions(options && options.fetchOpts);
+ var fetchOpts;
+ var checkoutOpts;
if (options) {
options = shallowClone(options);
+ fetchOpts = options.fetchOpts;
+ checkoutOpts = options.checkoutOpts;
delete options.fetchOpts;
+ delete options.checkoutOpts;
}
-
+
options = normalizeOptions(options, NodeGit.SubmoduleUpdateOptions);
- if (options) {
- options.fetchOpts = fetchOpts;
+ if (fetchOpts) {
+ options.fetchOpts = normalizeFetchOptions(fetchOpts);
+ }
+
+ if (checkoutOpts) {
+ options.checkoutOpts = normalizeOptions(
+ checkoutOpts,
+ NodeGit.CheckoutOptions
+ );
}
return _update.call(this, init, options);
diff --git a/package.json b/package.json
index 85a78848a..f05da0693 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "nodegit",
"description": "Node.js libgit2 asynchronous native bindings",
- "version": "0.20.2",
+ "version": "0.20.3",
"homepage": "http://nodegit.org",
"keywords": [
"libgit2",
diff --git a/test/tests/index.js b/test/tests/index.js
index aba18fa60..9f8dea7c0 100644
--- a/test/tests/index.js
+++ b/test/tests/index.js
@@ -13,6 +13,7 @@ describe("Index", function() {
var RepoUtils = require("../utils/repository_setup");
var NodeGit = require("../../");
var Repository = NodeGit.Repository;
+ var ErrorCodes = NodeGit.Error.CODE;
var reposPath = local("../repos/workdir");
@@ -359,4 +360,67 @@ describe("Index", function() {
assert(index.hasConflicts());
});
});
+
+ it("can find the specified file in the index", function() {
+ var test = this;
+
+ return test.index.find("src/wrapper.cc")
+ .then(function(position) {
+ assert.notEqual(position, null);
+ });
+ });
+
+ it("cannot find the specified file in the index", function() {
+ var test = this;
+
+ return test.index.find("src/thisisfake.cc")
+ .then(function(position) {
+ assert.fail("the item should not be found");
+ })
+ .catch(function(error) {
+ assert.strictEqual(error.errno, ErrorCodes.ENOTFOUND);
+ });
+ });
+
+ it("cannot find the directory in the index", function() {
+ var test = this;
+
+ return test.index.find("src")
+ .then(function(position) {
+ assert.fail("the item should not be found");
+ })
+ .catch(function(error) {
+ assert.strictEqual(error.errno, ErrorCodes.ENOTFOUND);
+ });
+ });
+
+ it("can find the specified prefix in the index", function() {
+ var test = this;
+
+ return test.index.findPrefix("src/")
+ .then(function(position) {
+ assert.notEqual(position, null);
+ });
+ });
+
+ it("cannot find the specified prefix in the index", function() {
+ var test = this;
+
+ return test.index.find("testing123/")
+ .then(function(position) {
+ assert.fail("the item should not be found");
+ })
+ .catch(function(error) {
+ assert.strictEqual(error.errno, ErrorCodes.ENOTFOUND);
+ });
+ });
+
+ it("can find the prefix when a file shares the name", function() {
+ var test = this;
+
+ return test.index.find("LICENSE")
+ .then(function(position) {
+ assert.notEqual(position, null);
+ });
+ });
});
diff --git a/vendor/libgit2 b/vendor/libgit2
index 3c1308d8c..da12bb87a 160000
--- a/vendor/libgit2
+++ b/vendor/libgit2
@@ -1 +1 @@
-Subproject commit 3c1308d8c1afa74d5da76ff1d3b2106d352ed36f
+Subproject commit da12bb87a7d206d3c8dfdd0922d0c3c7009965ba
diff --git a/vendor/libgit2.gyp b/vendor/libgit2.gyp
index f00470f99..59e2931b2 100644
--- a/vendor/libgit2.gyp
+++ b/vendor/libgit2.gyp
@@ -17,6 +17,7 @@
"GIT_THREADS",
"GIT_SSH",
"GIT_SSH_MEMORY_CREDENTIALS",
+ "LIBGIT2_NO_FEATURES_H",
# Node's util.h may be accidentally included so use this to guard
# against compilation error.
"SRC_UTIL_H_",