diff --git a/CHANGELOG.md b/CHANGELOG.md index 2435a2c8b..516919bed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,69 @@ # Change Log +## v0.19.0 [(2017-04-20)](https://github.com/nodegit/nodegit/releases/tag/v0.19.0) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.18.0...v0.19.0) + +#### 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: + + - [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) + - [filter: only close filter if it's been initialized correctly #4196](https://github.com/libgit2/libgit2/pull/4196) + - [Fix building against OpenSSL v1.1 #4195](https://github.com/libgit2/libgit2/pull/4195) + - [pkgconfig: fix handling of prefixes containing whitespaces #4193](https://github.com/libgit2/libgit2/pull/4193) + - [Refactor some of the win32 POSIX emulation #4192](https://github.com/libgit2/libgit2/pull/4192) + - [Correct non-existent file references in `odb.h` #4188](https://github.com/libgit2/libgit2/pull/4188) + - [Coverity #4183](https://github.com/libgit2/libgit2/pull/4183) + - [git_treebuilder_write_with_buffer refactorings #4182](https://github.com/libgit2/libgit2/pull/4182) + - [Fix memory leaks #4180](https://github.com/libgit2/libgit2/pull/4180) + - [sha1dc: perf improvements from upstream #4178](https://github.com/libgit2/libgit2/pull/4178) + - [inet_pton: don't assume addr families don't exist #4176](https://github.com/libgit2/libgit2/pull/4176) + - [git_futils: don't O_EXCL and O_TRUNC #4175](https://github.com/libgit2/libgit2/pull/4175) + - [Fix the documentation for git_cred_acquire_cb #4172](https://github.com/libgit2/libgit2/pull/4172) + - [Fix typo in remote.h API #4171](https://github.com/libgit2/libgit2/pull/4171) + - [Fix resolving absolute symlinks (on at least Win32) #4169](https://github.com/libgit2/libgit2/pull/4169) + - [Coverity fixes #4167](https://github.com/libgit2/libgit2/pull/4167) + - [Remove `map_free` macros #4166](https://github.com/libgit2/libgit2/pull/4166) + - [Worktree fixes #4163](https://github.com/libgit2/libgit2/pull/4163) + - [merge_driver: fix const-correctness for source getters #4162](https://github.com/libgit2/libgit2/pull/4162) + - [submodule: catch when submodule is not staged on update #4161](https://github.com/libgit2/libgit2/pull/4161) + - [Diff fixes #4160](https://github.com/libgit2/libgit2/pull/4160) + - [Skip uninteresting commits in revwalk timesort iterator #4157](https://github.com/libgit2/libgit2/pull/4157) + - [git_futils_readbuffer: don't compute sha-1 #4156](https://github.com/libgit2/libgit2/pull/4156) + - [Support namespaced references again #4154](https://github.com/libgit2/libgit2/pull/4154) + - [rebase: ignore untracked files in submodules #4151](https://github.com/libgit2/libgit2/pull/4151) + - [git_commit_create: freshen tree objects in commit #4150](https://github.com/libgit2/libgit2/pull/4150) + - [cmake: only enable supported compiler warning flags #4148](https://github.com/libgit2/libgit2/pull/4148) + - [winhttp: disambiguate error messages when sending requests #4146](https://github.com/libgit2/libgit2/pull/4146) + - [tests: refs::create: fix memory leak #4145](https://github.com/libgit2/libgit2/pull/4145) + - [Fix: make reflog include \"(merge)\" for merge commits #4143](https://github.com/libgit2/libgit2/pull/4143) + - [Fix minor typos in CONVENTIONS.md #4142](https://github.com/libgit2/libgit2/pull/4142) + - [Fix inet_pton tests triggering an assert in Haiku #4141](https://github.com/libgit2/libgit2/pull/4141) + - [README: Mention how to run tests #4139](https://github.com/libgit2/libgit2/pull/4139) + - [tests: Add create__symbolic_with_arbitrary_content #4138](https://github.com/libgit2/libgit2/pull/4138) + - [appveyor: don't rewrite the system mingw #4137](https://github.com/libgit2/libgit2/pull/4137) + - [Introduce (optional) SHA1 collision attack detection #4136](https://github.com/libgit2/libgit2/pull/4136) + - [Provide error on gcc < 4.1 when THREADSAFE #4135](https://github.com/libgit2/libgit2/pull/4135) + - [fix regression from #4092 #4133](https://github.com/libgit2/libgit2/pull/4133) + - [Attrcache cleanups #4131](https://github.com/libgit2/libgit2/pull/4131) + - [Improve clar messages #4130](https://github.com/libgit2/libgit2/pull/4130) + - [Minor comment fix #4127](https://github.com/libgit2/libgit2/pull/4127) + - [refdb: catch additional per-worktree refs #4124](https://github.com/libgit2/libgit2/pull/4124) + - [Signature cleanups #4122](https://github.com/libgit2/libgit2/pull/4122) + - [Changes to provide option to turn off/on ofs_delta #4115](https://github.com/libgit2/libgit2/pull/4115) + - [khash cleanups #4092](https://github.com/libgit2/libgit2/pull/4092) + - [fsync all the things #4030](https://github.com/libgit2/libgit2/pull/4030) + - [Worktree implementation #3436](https://github.com/libgit2/libgit2/pull/3436) + +#### 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) + - [Fix proxy auto detect not utilizing callbacks #4097](https://github.com/libgit2/libgit2/pull/4097) + ## v0.18.0 [(2017-02-28)](https://github.com/nodegit/nodegit/releases/tag/v0.18.0) [Full Changelog](https://github.com/nodegit/nodegit/compare/v0.17.0...v0.18.0) @@ -11,7 +75,6 @@ - `checkout_opts` in `Reset.fromAnnotated` and `Reset.reset` are now optional - `Reset.fromAnnotated` is now async - `message` on `Stash.save` is now optional - - `options` on `Stash.apply` and `Stash.pop` is now optional - Added `processMergeMessageCallback` on `Repository#mergeBranches` to allow for custom merge messages - Add `beforeFinishFn` to `Repository#rebaseBranches` and `Repository#continueRebase`. This is called before the invocation of `finish()`. If the callback returns a promise, `finish()` will be called when the promise resolves. The `beforeFinishFn` will be called with an object that has on it: - `ontoName` The name of the branch that we rebased onto diff --git a/README.md b/README.md index 91907f79b..029378eb9 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ NodeGit -**Stable (libgit2#master): 0.18.0** +**Stable (libgit2#master): 0.19.0** **Stable (libgit2@0.24): 0.14.1** ## Have a problem? Come chat with us! ## @@ -95,6 +95,12 @@ In CircleCI: - sudo apt-get install -y libstdc++-4.9-dev ``` +If you receive errors about *lifecycleScripts* preinstall/install you probably miss *libssl-dev* +In Ubuntu: +``` +sudo apt-get install libssl-dev +``` + If you are still encountering problems while installing, you should try the [Building from source](http://www.nodegit.org/guides/install/from-source/) instructions. diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index f1e26f1df..d33298c30 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -2590,6 +2590,17 @@ "return": { "ownedByThis": true } + }, + "git_tree_entry_to_object": { + "args": { + "object_out": { + "isReturn": true + } + }, + "return": { + "isErrorCode": true + }, + "isAsync": true } } }, diff --git a/lib/repository.js b/lib/repository.js index f2ba369da..90be1d91c 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -681,7 +681,7 @@ Repository.prototype.defaultSignature = function() { var result = NodeGit.Signature.default(this); if (!result || !result.name()) { - result = NodeGit.Signature.now("unknown", "unknown@unknown.com"); + result = NodeGit.Signature.now("unknown", "unknown@example.com"); } return result; diff --git a/package.json b/package.json index ff52b8d84..5becdd1c1 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.18.0", + "version": "0.19.0", "homepage": "http://nodegit.org", "keywords": [ "libgit2", diff --git a/test/tests/refs.js b/test/tests/refs.js index c2b148cc5..68b114e85 100644 --- a/test/tests/refs.js +++ b/test/tests/refs.js @@ -8,6 +8,7 @@ describe("Reference", function() { var NodeGit = require("../../"); var Repository = NodeGit.Repository; var Reference = NodeGit.Reference; + var Reflog = NodeGit.Reflog; var reposPath = local("../repos/workdir"); var refName = "refs/heads/master"; @@ -75,4 +76,49 @@ describe("Reference", function() { }); }); + it("can rename a reference", function() { + var newRefName = "refs/heads/chasta-boran"; + var ref = this.reference; + var repo = this.repository; + var reflogMessage = "reflog message"; + var refExistsMessage = "Renamed ref still exists"; + + return repo.getReference(newRefName) + .then(function() { + // The new ref name should not exist yet + throw new Error(refExistsMessage); + }) + .catch(function(err) { + // Should throw an error explaining that the ref + // does not exist + assert.ok(err.message.includes(newRefName)); + return ref.rename(newRefName, 0, reflogMessage); + }) + .then(function(reference) { + // The ref should be renamed at this point + assert.equal(reference.name(), newRefName); + return repo.getReference(refName); + }) + .then(function() { + // The original ref name should not be found + throw new Error(refExistsMessage); + }) + .catch(function(err) { + assert.ok(err.message.includes(refName)); + return Reflog.read(repo, newRefName); + }) + .then(function(reflog) { + var refEntryMessage = reflog + .entryByIndex(reflog.entrycount() - 1) + .message(); + // The reflog should have the message passed to + // the rename + assert.equal(refEntryMessage, reflogMessage); + return repo.getReference(newRefName); + }) + .then(function(newRef) { + // Set the ref name back to `master` + return newRef.rename(refName, 0, "another reflog message"); + }); + }); }); diff --git a/test/tests/signature.js b/test/tests/signature.js index 9049a2720..8e1187ef6 100644 --- a/test/tests/signature.js +++ b/test/tests/signature.js @@ -72,7 +72,7 @@ describe("Signature", function() { .then(function(repo) { var sig = repo.defaultSignature(); assert.equal(sig.name(), "unknown"); - assert.equal(sig.email(), "unknown@unknown.com"); + assert.equal(sig.email(), "unknown@example.com"); }) .then(cleanUp) .then(done) diff --git a/test/tests/tree_entry.js b/test/tests/tree_entry.js index b4d0706c5..13093fdaa 100644 --- a/test/tests/tree_entry.js +++ b/test/tests/tree_entry.js @@ -156,6 +156,28 @@ describe("TreeEntry", function() { }); }); + it("can convert entry into a blob", function() { + var repo = this.repository; + return this.commit.getEntry("README.md") + .then(function(entry) { + return entry.toObject(repo); + }) + .then(function(object) { + assert.equal(object.isBlob(), true); + }); + }); + + it("can convert entry into a tree", function() { + var repo = this.repository; + return this.commit.getEntry("example") + .then(function(entry) { + return entry.toObject(repo); + }) + .then(function(object) { + assert.equal(object.isTree(), true); + }); + }); + it("does not leak", function() { var test = this; diff --git a/vendor/libgit2 b/vendor/libgit2 index 12f0b704d..9e76f2c72 160000 --- a/vendor/libgit2 +++ b/vendor/libgit2 @@ -1 +1 @@ -Subproject commit 12f0b704d2d3269db5bc6d95f098aea3eb645f63 +Subproject commit 9e76f2c72bb562aba6f72b95216bc4e885a46551 diff --git a/vendor/libgit2.gyp b/vendor/libgit2.gyp index 539f6e9ba..f00470f99 100644 --- a/vendor/libgit2.gyp +++ b/vendor/libgit2.gyp @@ -31,11 +31,12 @@ "libgit2/include/git2/sys/hashsig.h", "libgit2/include/git2/sys/merge.h", "libgit2/include/git2/sys/time.h", + "libgit2/include/git2/worktree.h", "libgit2/src/annotated_commit.c", "libgit2/src/annotated_commit.h", - "libgit2/src/array.h", "libgit2/src/apply.c", "libgit2/src/apply.h", + "libgit2/src/array.h", "libgit2/src/attr_file.c", "libgit2/src/attr_file.h", "libgit2/src/attr.c", @@ -74,9 +75,9 @@ "libgit2/src/config_file.h", "libgit2/src/config.c", "libgit2/src/config.h", + "libgit2/src/crlf.c", "libgit2/src/curl_stream.c", "libgit2/src/curl_stream.h", - "libgit2/src/crlf.c", "libgit2/src/date.c", "libgit2/src/delta.c", "libgit2/src/delta.h", @@ -114,24 +115,27 @@ "libgit2/src/graph.c", "libgit2/src/hash.c", "libgit2/src/hash.h", - "libgit2/src/hash/hash_generic.c", - "libgit2/src/hash/hash_generic.h", - "libgit2/src/hash/hash_openssl.h", + "libgit2/src/hash/sha1dc/sha1.c", + "libgit2/src/hash/sha1dc/sha1.h", + "libgit2/src/hash/sha1dc/ubc_check.c", + "libgit2/src/hash/sha1dc/ubc_check.h", "libgit2/src/hashsig.c", "libgit2/src/ident.c", + "libgit2/src/idxmap.c", "libgit2/src/ignore.c", "libgit2/src/ignore.h", "libgit2/src/index.c", "libgit2/src/index.h", "libgit2/src/indexer.c", + "libgit2/src/indexer.h", "libgit2/src/iterator.c", "libgit2/src/iterator.h", "libgit2/src/khash.h", "libgit2/src/map.h", + "libgit2/src/merge_driver.c", "libgit2/src/merge_file.c", "libgit2/src/merge_file.h", "libgit2/src/merge.c", - "libgit2/src/merge_driver.c", "libgit2/src/merge.h", "libgit2/src/message.c", "libgit2/src/message.h", @@ -149,11 +153,13 @@ "libgit2/src/odb_pack.c", "libgit2/src/odb.c", "libgit2/src/odb.h", + "libgit2/src/offmap.c", "libgit2/src/offmap.h", "libgit2/src/oid.c", "libgit2/src/oid.h", "libgit2/src/oidarray.c", "libgit2/src/oidarray.h", + "libgit2/src/oidmap.c", "libgit2/src/oidmap.h", "libgit2/src/openssl_stream.c", "libgit2/src/openssl_stream.h", @@ -161,14 +167,14 @@ "libgit2/src/pack-objects.h", "libgit2/src/pack.c", "libgit2/src/pack.h", - "libgit2/src/path.c", - "libgit2/src/path.h", - "libgit2/src/patch.c", - "libgit2/src/patch.h", "libgit2/src/patch_generate.c", "libgit2/src/patch_generate.h", "libgit2/src/patch_parse.c", "libgit2/src/patch_parse.h", + "libgit2/src/patch.c", + "libgit2/src/patch.h", + "libgit2/src/path.c", + "libgit2/src/path.h", "libgit2/src/pathspec.c", "libgit2/src/pathspec.h", "libgit2/src/pool.c", @@ -252,6 +258,8 @@ "libgit2/src/varint.h", "libgit2/src/vector.c", "libgit2/src/vector.h", + "libgit2/src/worktree.c", + "libgit2/src/worktree.h", "libgit2/src/xdiff/xdiff.h", "libgit2/src/xdiff/xdiffi.c", "libgit2/src/xdiff/xdiffi.h", @@ -278,9 +286,7 @@ ], "sources": [ "libgit2/src/stransport_stream.c", - "libgit2/src/stransport_stream.h", - "libgit2/src/tls_stream.c", - "libgit2/src/tls_stream.h" + "libgit2/src/stransport_stream.h" ], "link_settings": { "xcode_settings": { @@ -296,7 +302,13 @@ "-DGIT_CURL" ], "defines": [ - "GIT_CURL" + "GIT_CURL", + "GIT_SHA1_OPENSSL" + ], + "sources": [ + "libgit2/src/hash/hash_openssl.h", + "libgit2/src/tls_stream.c", + "libgit2/src/tls_stream.h" ] }], ["OS=='linux' or OS.endswith('bsd')" , { @@ -308,15 +320,12 @@ "defines": [ "GIT_OPENSSL", "GIT_USE_STAT_MTIM" - ], - "sources": [ - "libgit2/src/tls_stream.c", - "libgit2/src/tls_stream.h" ] }], ["OS=='win'", { "defines": [ "GIT_WINHTTP", + "GIT_SHA1_WIN32" ], "msvs_settings": { "VCLinkerTool": { @@ -359,6 +368,8 @@ ], "sources": [ "libgit2/deps/regex/regex.c", + "libgit2/src/hash/hash_win32.c", + "libgit2/src/hash/hash_win32.h", "libgit2/src/transports/winhttp.c", "libgit2/src/win32/dir.c", "libgit2/src/win32/dir.h",