diff --git a/.travis.yml b/.travis.yml index eccf39e5b..426563ef4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,11 +15,23 @@ before_install: - nvm use $NODE_VERSION - if [ $TRAVIS_OS_NAME == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; - sudo apt-get -qq update; - sudo apt-get -qq install g++-4.8; - export CXX='g++-4.8'; + sudo apt-get update; + sudo apt-get install gcc-4.9 g++-4.9 lcov; + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20; + sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20; + sudo update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-4.9 20; + sudo update-alternatives --config gcc; + sudo update-alternatives --config g++; + sudo update-alternatives --config gcov; + wget http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz; + tar xvfz lcov-1.10.tar.gz; + sudo cp -v lcov-1.10/bin/{lcov,genpng,gendesc,genhtml,geninfo} /usr/bin/; + sudo chmod 777 /usr/bin/lcov /usr/bin/genhtml /usr/bin/geninfo /usr/bin/genpng /usg/bin/gendesc; + rm -rf lcov-1.10.tar.gz lcov-1.10; + sudo mv -v `which gcov-4.8` `which gcov`; + export GYP_DEFINES="coverage=1"; + export JOBS=4; fi - - "export JOBS=4" - BUILD_ONLY=true npm install # This is a random private key used purely for testing. before_script: @@ -40,7 +52,12 @@ branches: os: - linux - osx -script: npm test +script: + - if [ $TRAVIS_OS_NAME == "linux" ] && [ $NODE_VERSION == "0.12" ]; then + npm test && npm run cov && npm run coveralls; + else + npm test; + fi notifications: slack: secure: KglNSqZiid9YudCwkPFDh+sZfW5BwFlM70y67E4peHwwlbbV1sSBPHcs74ZHP/lqgEZ4hMv4N2NI58oYFD5/1a+tKIQP1TkdIMuq4j2LXheuirA2HDcydOVrsC8kRx5XFGKdVRg/uyX2dlRHcOWFhxrS6yc6IxtxYWlRTD2SmEc= diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..a9734feb9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,1093 @@ +# Change Log + +## [v0.4.0](https://github.com/nodegit/nodegit/tree/v0.4.0) (2015-05-07) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.3.3...v0.4.0) + +**Closed issues:** + +- Error installing nodegit as dependency of an atom-shell app [\#556](https://github.com/nodegit/nodegit/issues/556) + +- New version of nan is breaking compile [\#554](https://github.com/nodegit/nodegit/issues/554) + +- Install error from openssl [\#551](https://github.com/nodegit/nodegit/issues/551) + +- How to get Tag instance by tag\_name? [\#543](https://github.com/nodegit/nodegit/issues/543) + +- ELIFECYCLE Error on install [\#540](https://github.com/nodegit/nodegit/issues/540) + +- Remote.delete returns -3 [\#539](https://github.com/nodegit/nodegit/issues/539) + +- Repository.init should accept boolean value for is\_bare [\#538](https://github.com/nodegit/nodegit/issues/538) + +- getStatus hangs [\#537](https://github.com/nodegit/nodegit/issues/537) + +- Unable to compile or install with npm install nodegit [\#536](https://github.com/nodegit/nodegit/issues/536) + +- `options` not reusable, nodegit destroys it [\#533](https://github.com/nodegit/nodegit/issues/533) + +- 'Error: 'directory' exists and is not an empty directory' \(but it doesn't exist\) [\#530](https://github.com/nodegit/nodegit/issues/530) + +- hey !:-\) problem with Branch.iteratorNew \(support\) [\#528](https://github.com/nodegit/nodegit/issues/528) + +- hey !:-\) problem with Branch.iteratorNew [\#527](https://github.com/nodegit/nodegit/issues/527) + +- hey !:-\) problem with Branch.iteratorNew [\#526](https://github.com/nodegit/nodegit/issues/526) + +- hey !:-\) problem with Branch.iteratorNew [\#525](https://github.com/nodegit/nodegit/issues/525) + +- Error: Reference 'refs/remotes/user/foo/HEAD' not found [\#523](https://github.com/nodegit/nodegit/issues/523) + +- Path issues windows [\#522](https://github.com/nodegit/nodegit/issues/522) + +- Issues on scientific linux 6.6 [\#521](https://github.com/nodegit/nodegit/issues/521) + +- It's looking for node-typ under `/Users/johnh/.node-gyp` [\#518](https://github.com/nodegit/nodegit/issues/518) + +- Not working with iojs [\#516](https://github.com/nodegit/nodegit/issues/516) + +- Cred.sshKeyNew not working: Too many redirects or authentication replays [\#511](https://github.com/nodegit/nodegit/issues/511) + +- Open a Repo from a subfolder [\#509](https://github.com/nodegit/nodegit/issues/509) + +- Create git-like CLI [\#508](https://github.com/nodegit/nodegit/issues/508) + +- Cannot create an instance of Packbuilder [\#507](https://github.com/nodegit/nodegit/issues/507) + +- Cannot find module '../build/Debug/nodegit' [\#506](https://github.com/nodegit/nodegit/issues/506) + +- Bug with oid implicit cast inside C++ [\#501](https://github.com/nodegit/nodegit/issues/501) + +- Failed to `require` on Ubuntu 12.04LTS [\#493](https://github.com/nodegit/nodegit/issues/493) + +- Enable `git\_config` [\#449](https://github.com/nodegit/nodegit/issues/449) + +- Pull example doesn't fully update the index [\#389](https://github.com/nodegit/nodegit/issues/389) + +**Merged pull requests:** + +- There is an incompatibility with NaN 1.8.x, keeping 1.7.x for now. [\#552](https://github.com/nodegit/nodegit/pull/552) ([wiggzz](https://github.com/wiggzz)) + +- A wrapper for git\_diff\_blob\_to\_buffer [\#550](https://github.com/nodegit/nodegit/pull/550) ([bleathem](https://github.com/bleathem)) + +- A wrapper for git\_diff\_blob\_to\_buffer [\#549](https://github.com/nodegit/nodegit/pull/549) ([bleathem](https://github.com/bleathem)) + +- Removed the superflous "line" argument [\#547](https://github.com/nodegit/nodegit/pull/547) ([bleathem](https://github.com/bleathem)) + +- This fixes polling sync promises in callbacks. [\#546](https://github.com/nodegit/nodegit/pull/546) ([johnhaley81](https://github.com/johnhaley81)) + +- Add get/set config string methods and tests [\#545](https://github.com/nodegit/nodegit/pull/545) ([johnhaley81](https://github.com/johnhaley81)) + +- Make `Remote.delete` async and return error messages correctly [\#544](https://github.com/nodegit/nodegit/pull/544) ([johnhaley81](https://github.com/johnhaley81)) + +- Bump "nodegit-promise" version [\#542](https://github.com/nodegit/nodegit/pull/542) ([johnhaley81](https://github.com/johnhaley81)) + +- Introduced a new ConvenientLine class to wrap the lines returned from ConvenientHunk. [\#541](https://github.com/nodegit/nodegit/pull/541) ([bleathem](https://github.com/bleathem)) + +- Fix some things missed by the generating scripts [\#535](https://github.com/nodegit/nodegit/pull/535) ([johnhaley81](https://github.com/johnhaley81)) + +- Attempt remove the delete keyword [\#534](https://github.com/nodegit/nodegit/pull/534) ([tbranyen](https://github.com/tbranyen)) + +- Fix freeing a `GitOid` that was passed as a string [\#531](https://github.com/nodegit/nodegit/pull/531) ([johnhaley81](https://github.com/johnhaley81)) + +- fix typo: "byes" [\#529](https://github.com/nodegit/nodegit/pull/529) ([rutsky](https://github.com/rutsky)) + +- Add convenience methods to status file [\#524](https://github.com/nodegit/nodegit/pull/524) ([maxkorp](https://github.com/maxkorp)) + +- Lots of complaints of missing build/Debug/nodegit [\#520](https://github.com/nodegit/nodegit/pull/520) ([tbranyen](https://github.com/tbranyen)) + +- Add `Graph.aheadBehind` and tests [\#517](https://github.com/nodegit/nodegit/pull/517) ([johnhaley81](https://github.com/johnhaley81)) + +- Update to use libgit2 v0.22.2 [\#515](https://github.com/nodegit/nodegit/pull/515) ([johnhaley81](https://github.com/johnhaley81)) + +- Add `Repository.prototype.fetchheadForeach` and tests [\#514](https://github.com/nodegit/nodegit/pull/514) ([johnhaley81](https://github.com/johnhaley81)) + +- Converted create methods to be synchronous [\#513](https://github.com/nodegit/nodegit/pull/513) ([tbranyen](https://github.com/tbranyen)) + +- Fix atom-shell build on windows [\#512](https://github.com/nodegit/nodegit/pull/512) ([johnhaley81](https://github.com/johnhaley81)) + +- Update Checkout and Merge [\#505](https://github.com/nodegit/nodegit/pull/505) ([orderedlist](https://github.com/orderedlist)) + +- Add note tests [\#504](https://github.com/nodegit/nodegit/pull/504) ([tbranyen](https://github.com/tbranyen)) + +- Revert "Guide navigation is currently confusing" [\#503](https://github.com/nodegit/nodegit/pull/503) ([thgaskell](https://github.com/thgaskell)) + +- Improve coverage [\#502](https://github.com/nodegit/nodegit/pull/502) ([tbranyen](https://github.com/tbranyen)) + +- Adds in CPP code coverage and joined JS [\#499](https://github.com/nodegit/nodegit/pull/499) ([tbranyen](https://github.com/tbranyen)) + +- Add twitter username to README.md [\#498](https://github.com/nodegit/nodegit/pull/498) ([johnhaley81](https://github.com/johnhaley81)) + +- Fix symbolic reference handling in getReferences [\#496](https://github.com/nodegit/nodegit/pull/496) ([billt2006](https://github.com/billt2006)) + +- Enable `git\_stash\_foreach` [\#495](https://github.com/nodegit/nodegit/pull/495) ([johnhaley81](https://github.com/johnhaley81)) + +- Guide navigation is currently confusing [\#494](https://github.com/nodegit/nodegit/pull/494) ([tbranyen](https://github.com/tbranyen)) + +- Fix gitter badge for npm [\#492](https://github.com/nodegit/nodegit/pull/492) ([billt2006](https://github.com/billt2006)) + +- Add automatically generated change log file. [\#465](https://github.com/nodegit/nodegit/pull/465) ([skywinder](https://github.com/skywinder)) + +## [v0.3.3](https://github.com/nodegit/nodegit/tree/v0.3.3) (2015-03-16) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.3.2...v0.3.3) + +**Merged pull requests:** + +- Download all dev dependencies before build [\#491](https://github.com/nodegit/nodegit/pull/491) ([johnhaley81](https://github.com/johnhaley81)) + +## [v0.3.2](https://github.com/nodegit/nodegit/tree/v0.3.2) (2015-03-16) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.3.1...v0.3.2) + +**Closed issues:** + +- Amazon S3 CDN link is broken [\#482](https://github.com/nodegit/nodegit/issues/482) + +**Merged pull requests:** + +- Confirm builder exists before building [\#490](https://github.com/nodegit/nodegit/pull/490) ([johnhaley81](https://github.com/johnhaley81)) + +## [v0.3.1](https://github.com/nodegit/nodegit/tree/v0.3.1) (2015-03-14) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.3.0...v0.3.1) + +**Merged pull requests:** + +- Revert node-pre-gyp to install not build [\#486](https://github.com/nodegit/nodegit/pull/486) ([tbranyen](https://github.com/tbranyen)) + +## [v0.3.0](https://github.com/nodegit/nodegit/tree/v0.3.0) (2015-03-13) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.2.7...v0.3.0) + +**Closed issues:** + +- Push [\#463](https://github.com/nodegit/nodegit/issues/463) + +- Suppress astyle errors [\#459](https://github.com/nodegit/nodegit/issues/459) + +- io.js support [\#447](https://github.com/nodegit/nodegit/issues/447) + +- Meteor: icon fonts not working \(Resource interpreted as Font but transferred with MIME type text/html\) [\#443](https://github.com/nodegit/nodegit/issues/443) + +- AnnotatedCommit.x listing as Annotated.commitX [\#437](https://github.com/nodegit/nodegit/issues/437) + +- fetchAll\(\) fails unless a default signature is available [\#431](https://github.com/nodegit/nodegit/issues/431) + +- Question: Is there a certificateCheck option available for pushing to a remote repository? [\#420](https://github.com/nodegit/nodegit/issues/420) + +- Repository.open returns empty object [\#412](https://github.com/nodegit/nodegit/issues/412) + +- Missing documentation for Tree.walk\(\) [\#411](https://github.com/nodegit/nodegit/issues/411) + +- comparing from 0.1.4 to 0.2.0 [\#410](https://github.com/nodegit/nodegit/issues/410) + +- Potential example issue in add-and-commit.js L45-48 [\#409](https://github.com/nodegit/nodegit/issues/409) + +- failed to install on ubuntu 14.04 [\#408](https://github.com/nodegit/nodegit/issues/408) + +- Return promises instead of nesting them [\#407](https://github.com/nodegit/nodegit/issues/407) + +- segfault when cloning from private BitBucket repo [\#406](https://github.com/nodegit/nodegit/issues/406) + +- Subtrees + custom error handling [\#400](https://github.com/nodegit/nodegit/issues/400) + +- How to use nodegit in atom shell ..... [\#393](https://github.com/nodegit/nodegit/issues/393) + +- Cannot create a new branch [\#391](https://github.com/nodegit/nodegit/issues/391) + +- Remove fixappveyor from clone tests [\#385](https://github.com/nodegit/nodegit/issues/385) + +- Commit isn't working [\#381](https://github.com/nodegit/nodegit/issues/381) + +- Rename combyne folder to templates [\#378](https://github.com/nodegit/nodegit/issues/378) + +- Cloning SSH repos seem to fail [\#372](https://github.com/nodegit/nodegit/issues/372) + +- Commit.getDiff is backwards? [\#368](https://github.com/nodegit/nodegit/issues/368) + +- List all files in repo \(git ls-tree\) [\#365](https://github.com/nodegit/nodegit/issues/365) + +- Checking out a branch [\#361](https://github.com/nodegit/nodegit/issues/361) + +- nodegit no longer builds in nwjs [\#360](https://github.com/nodegit/nodegit/issues/360) + +- Module install/build fails on Heroku [\#332](https://github.com/nodegit/nodegit/issues/332) + +- 2 Step Authentication [\#323](https://github.com/nodegit/nodegit/issues/323) + +**Merged pull requests:** + +- Rename `Annotated` to `AnnotatedCommit` [\#485](https://github.com/nodegit/nodegit/pull/485) ([johnhaley81](https://github.com/johnhaley81)) + +- Bump version to 0.3.0 [\#484](https://github.com/nodegit/nodegit/pull/484) ([johnhaley81](https://github.com/johnhaley81)) + +- Remove unneeded connect call from push example [\#483](https://github.com/nodegit/nodegit/pull/483) ([johnhaley81](https://github.com/johnhaley81)) + +- Update push example [\#481](https://github.com/nodegit/nodegit/pull/481) ([billt2006](https://github.com/billt2006)) + +- Fix trailing space in atom-shell windows install [\#480](https://github.com/nodegit/nodegit/pull/480) ([johnhaley81](https://github.com/johnhaley81)) + +- Fix atom-shell install on windows [\#479](https://github.com/nodegit/nodegit/pull/479) ([johnhaley81](https://github.com/johnhaley81)) + +- Updated API documentation link to work with NPM's markdown renderer. [\#477](https://github.com/nodegit/nodegit/pull/477) ([hughfdjackson](https://github.com/hughfdjackson)) + +- Add option to `fetch` to prune the remote afterwards [\#476](https://github.com/nodegit/nodegit/pull/476) ([johnhaley81](https://github.com/johnhaley81)) + +- Make index.addAll use status to increase performance [\#475](https://github.com/nodegit/nodegit/pull/475) ([maxkorp](https://github.com/maxkorp)) + +- Add defaults to `Remote.prototype.push` [\#474](https://github.com/nodegit/nodegit/pull/474) ([johnhaley81](https://github.com/johnhaley81)) + +- Fix `createCommitOnHead` [\#473](https://github.com/nodegit/nodegit/pull/473) ([johnhaley81](https://github.com/johnhaley81)) + +- Move guides around to remove subindexes [\#472](https://github.com/nodegit/nodegit/pull/472) ([orderedlist](https://github.com/orderedlist)) + +- Put `Remote.Push` on the remote prototype [\#470](https://github.com/nodegit/nodegit/pull/470) ([johnhaley81](https://github.com/johnhaley81)) + +- Change Repository.prototype.setHead to be asynchronous [\#469](https://github.com/nodegit/nodegit/pull/469) ([jrbalsano](https://github.com/jrbalsano)) + +- Test in Node 0.12 and io.js [\#468](https://github.com/nodegit/nodegit/pull/468) ([tbranyen](https://github.com/tbranyen)) + +- Add checkoutBranch convenience method [\#466](https://github.com/nodegit/nodegit/pull/466) ([johnhaley81](https://github.com/johnhaley81)) + +- Don't assign enums to \_\_proto\_\_ [\#464](https://github.com/nodegit/nodegit/pull/464) ([orderedlist](https://github.com/orderedlist)) + +- Fix push example [\#462](https://github.com/nodegit/nodegit/pull/462) ([johnhaley81](https://github.com/johnhaley81)) + +- Adds support for strarray in structs [\#461](https://github.com/nodegit/nodegit/pull/461) ([orderedlist](https://github.com/orderedlist)) + +- supress astyle warnings [\#460](https://github.com/nodegit/nodegit/pull/460) ([maxkorp](https://github.com/maxkorp)) + +- Template proto functions [\#458](https://github.com/nodegit/nodegit/pull/458) ([maxkorp](https://github.com/maxkorp)) + +- Remote push [\#457](https://github.com/nodegit/nodegit/pull/457) ([mattyclarkson](https://github.com/mattyclarkson)) + +- Include missing lib files in nodegit.js template [\#455](https://github.com/nodegit/nodegit/pull/455) ([orderedlist](https://github.com/orderedlist)) + +- StrArray memory fix [\#454](https://github.com/nodegit/nodegit/pull/454) ([mattyclarkson](https://github.com/mattyclarkson)) + +- Better cloning with NodeGit [\#453](https://github.com/nodegit/nodegit/pull/453) ([tbranyen](https://github.com/tbranyen)) + +- Add Diff.prototype.findSimilar [\#452](https://github.com/nodegit/nodegit/pull/452) ([orderedlist](https://github.com/orderedlist)) + +- Str array converter fix [\#451](https://github.com/nodegit/nodegit/pull/451) ([mattyclarkson](https://github.com/mattyclarkson)) + +- Default signature always returns valid signature [\#450](https://github.com/nodegit/nodegit/pull/450) ([johnhaley81](https://github.com/johnhaley81)) + +- Status.byIndex and StatusEntry [\#448](https://github.com/nodegit/nodegit/pull/448) ([orderedlist](https://github.com/orderedlist)) + +- Upgrade to nan 1.7.0 [\#446](https://github.com/nodegit/nodegit/pull/446) ([orderedlist](https://github.com/orderedlist)) + +- Added in an HTTP url for test [\#445](https://github.com/nodegit/nodegit/pull/445) ([tbranyen](https://github.com/tbranyen)) + +- Add examples [\#442](https://github.com/nodegit/nodegit/pull/442) ([johnhaley81](https://github.com/johnhaley81)) + +- hide callback payloads from javascript [\#441](https://github.com/nodegit/nodegit/pull/441) ([maxkorp](https://github.com/maxkorp)) + +- Fix transfer callback stats [\#440](https://github.com/nodegit/nodegit/pull/440) ([johnhaley81](https://github.com/johnhaley81)) + +- Put `uv\_async\_init` on main thread [\#438](https://github.com/nodegit/nodegit/pull/438) ([johnhaley81](https://github.com/johnhaley81)) + +- Automatically free repositories post clone [\#434](https://github.com/nodegit/nodegit/pull/434) ([tbranyen](https://github.com/tbranyen)) + +- Skip transfer progress test until it's fixed [\#433](https://github.com/nodegit/nodegit/pull/433) ([johnhaley81](https://github.com/johnhaley81)) + +- Change environment to default for upgraded service [\#428](https://github.com/nodegit/nodegit/pull/428) ([maxkorp](https://github.com/maxkorp)) + +- Make the `git\_remote\_push` function async [\#427](https://github.com/nodegit/nodegit/pull/427) ([johnhaley81](https://github.com/johnhaley81)) + +- Fix file lock 2 [\#426](https://github.com/nodegit/nodegit/pull/426) ([tbranyen](https://github.com/tbranyen)) + +- Attempt to fix Windows file locking bug [\#425](https://github.com/nodegit/nodegit/pull/425) ([tbranyen](https://github.com/tbranyen)) + +- Fix seg faults [\#424](https://github.com/nodegit/nodegit/pull/424) ([johnhaley81](https://github.com/johnhaley81)) + +- Clean up the persisting of props [\#423](https://github.com/nodegit/nodegit/pull/423) ([johnhaley81](https://github.com/johnhaley81)) + +- Fix indexEntry construction and blobFromBuffer [\#422](https://github.com/nodegit/nodegit/pull/422) ([orderedlist](https://github.com/orderedlist)) + +- Allow for saving of props to an object [\#421](https://github.com/nodegit/nodegit/pull/421) ([johnhaley81](https://github.com/johnhaley81)) + +- Fixes segfault issue recorded in \#406 [\#419](https://github.com/nodegit/nodegit/pull/419) ([tbranyen](https://github.com/tbranyen)) + +- Update jsdoc and ignore some methods [\#418](https://github.com/nodegit/nodegit/pull/418) ([orderedlist](https://github.com/orderedlist)) + +- Converting Examples to Guides [\#417](https://github.com/nodegit/nodegit/pull/417) ([tbranyen](https://github.com/tbranyen)) + +- Fix callbacks with just return value and single payload [\#416](https://github.com/nodegit/nodegit/pull/416) ([johnhaley81](https://github.com/johnhaley81)) + +- Add `git\_reset` and `git\_reset\_default` [\#415](https://github.com/nodegit/nodegit/pull/415) ([johnhaley81](https://github.com/johnhaley81)) + +- Enable `git\_index\_remove\_all` and `git\_index\_update\_all` [\#414](https://github.com/nodegit/nodegit/pull/414) ([johnhaley81](https://github.com/johnhaley81)) + +- Added code for `git\_strarray` and enabled `git\_index\_add\_all` [\#413](https://github.com/nodegit/nodegit/pull/413) ([johnhaley81](https://github.com/johnhaley81)) + +- Tree Entry getBlob\(\) should also support the callback pattern. [\#405](https://github.com/nodegit/nodegit/pull/405) ([jeffwilcox](https://github.com/jeffwilcox)) + +- Tree Entry getBlob\(\) should also support the callback pattern. [\#404](https://github.com/nodegit/nodegit/pull/404) ([jeffwilcox](https://github.com/jeffwilcox)) + +- Adds in git\_checkout\_tree [\#402](https://github.com/nodegit/nodegit/pull/402) ([tbranyen](https://github.com/tbranyen)) + +- Made changes to the README [\#399](https://github.com/nodegit/nodegit/pull/399) ([tbranyen](https://github.com/tbranyen)) + +- Expose gc so all tests run in CI [\#398](https://github.com/nodegit/nodegit/pull/398) ([tbranyen](https://github.com/tbranyen)) + +- One more dependency update [\#397](https://github.com/nodegit/nodegit/pull/397) ([maxkorp](https://github.com/maxkorp)) + +- Update moar dependencies. [\#396](https://github.com/nodegit/nodegit/pull/396) ([maxkorp](https://github.com/maxkorp)) + +- Updated most dependencies to latest versions [\#394](https://github.com/nodegit/nodegit/pull/394) ([johnhaley81](https://github.com/johnhaley81)) + +- Index diffing [\#392](https://github.com/nodegit/nodegit/pull/392) ([orderedlist](https://github.com/orderedlist)) + +- Update to libgit2 v0.22.1 [\#390](https://github.com/nodegit/nodegit/pull/390) ([johnhaley81](https://github.com/johnhaley81)) + +- Fix test issues [\#388](https://github.com/nodegit/nodegit/pull/388) ([maxkorp](https://github.com/maxkorp)) + +- Fix building when a space is in the path [\#387](https://github.com/nodegit/nodegit/pull/387) ([billt2006](https://github.com/billt2006)) + +- General maintenance [\#386](https://github.com/nodegit/nodegit/pull/386) ([maxkorp](https://github.com/maxkorp)) + +- Add 2 convenience methods to revwalk [\#384](https://github.com/nodegit/nodegit/pull/384) ([maxkorp](https://github.com/maxkorp)) + +- Make all cred generators sync. [\#377](https://github.com/nodegit/nodegit/pull/377) ([maxkorp](https://github.com/maxkorp)) + +- Plaintext credential not async [\#375](https://github.com/nodegit/nodegit/pull/375) ([mbleigh](https://github.com/mbleigh)) + +- Status and StatusList [\#374](https://github.com/nodegit/nodegit/pull/374) ([orderedlist](https://github.com/orderedlist)) + +- Fix the package scripts [\#373](https://github.com/nodegit/nodegit/pull/373) ([maxkorp](https://github.com/maxkorp)) + +- Removes Node 0.11 testing completely [\#371](https://github.com/nodegit/nodegit/pull/371) ([tbranyen](https://github.com/tbranyen)) + +- Allow null trees on Diff.treeToTree [\#370](https://github.com/nodegit/nodegit/pull/370) ([orderedlist](https://github.com/orderedlist)) + +- Atom shell support [\#369](https://github.com/nodegit/nodegit/pull/369) ([maxkorp](https://github.com/maxkorp)) + +- `Checkout.head` initializes options if none are passed [\#367](https://github.com/nodegit/nodegit/pull/367) ([johnhaley81](https://github.com/johnhaley81)) + +- INCLUDE\_UNTRACKED option not working for diffs [\#366](https://github.com/nodegit/nodegit/pull/366) ([kmctown](https://github.com/kmctown)) + +- Updated fs-extra to 0.15.0 [\#363](https://github.com/nodegit/nodegit/pull/363) ([johnhaley81](https://github.com/johnhaley81)) + +- update to libgit2 v0.21.5 [\#362](https://github.com/nodegit/nodegit/pull/362) ([maxkorp](https://github.com/maxkorp)) + +- Make remote\#download async [\#326](https://github.com/nodegit/nodegit/pull/326) ([tbranyen](https://github.com/tbranyen)) + +- Enable transfer progress [\#325](https://github.com/nodegit/nodegit/pull/325) ([tbranyen](https://github.com/tbranyen)) + +## [v0.2.7](https://github.com/nodegit/nodegit/tree/v0.2.7) (2015-01-21) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.2.6...v0.2.7) + +## [v0.2.6](https://github.com/nodegit/nodegit/tree/v0.2.6) (2015-01-20) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.2.5...v0.2.6) + +**Merged pull requests:** + +- \[WIP\] Added in some diff functions from libgit2 [\#348](https://github.com/nodegit/nodegit/pull/348) ([johnhaley81](https://github.com/johnhaley81)) + +## [v0.2.5](https://github.com/nodegit/nodegit/tree/v0.2.5) (2015-01-20) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.2.4...v0.2.5) + +**Closed issues:** + +- Lookup a non existent commit crashes the process. [\#353](https://github.com/nodegit/nodegit/issues/353) + +- Why node-git uses 90% rotated hexagon? [\#344](https://github.com/nodegit/nodegit/issues/344) + +- Needed pull example or help with code [\#341](https://github.com/nodegit/nodegit/issues/341) + +- Can't require nodegit without building it explicitly [\#340](https://github.com/nodegit/nodegit/issues/340) + +- Tracking down bugs [\#331](https://github.com/nodegit/nodegit/issues/331) + +- Document possible values of CloneOptions [\#330](https://github.com/nodegit/nodegit/issues/330) + +- Require generating error [\#329](https://github.com/nodegit/nodegit/issues/329) + +- Failed getting Banner [\#328](https://github.com/nodegit/nodegit/issues/328) + +- Documentation broken [\#327](https://github.com/nodegit/nodegit/issues/327) + +- Fetch doesn't seem to work with https urls. [\#322](https://github.com/nodegit/nodegit/issues/322) + +**Merged pull requests:** + +- Refactor installation and publication [\#359](https://github.com/nodegit/nodegit/pull/359) ([maxkorp](https://github.com/maxkorp)) + +- Lint examples [\#358](https://github.com/nodegit/nodegit/pull/358) ([maxkorp](https://github.com/maxkorp)) + +- Commit.getParents working with merge commits [\#357](https://github.com/nodegit/nodegit/pull/357) ([bjornarg](https://github.com/bjornarg)) + +- Fixed a typo in the debug build instruction. [\#356](https://github.com/nodegit/nodegit/pull/356) ([mcollina](https://github.com/mcollina)) + +- Added a null check on freeing the raw object [\#354](https://github.com/nodegit/nodegit/pull/354) ([johnhaley81](https://github.com/johnhaley81)) + +- \[WIP\] Attempt at fixing appveyor [\#352](https://github.com/nodegit/nodegit/pull/352) ([johnhaley81](https://github.com/johnhaley81)) + +- Updated to nan 1.5.0 and fixed build errors [\#351](https://github.com/nodegit/nodegit/pull/351) ([johnhaley81](https://github.com/johnhaley81)) + +- WIP: Refactor publishing [\#350](https://github.com/nodegit/nodegit/pull/350) ([maxkorp](https://github.com/maxkorp)) + +- Added debug build instructions. [\#349](https://github.com/nodegit/nodegit/pull/349) ([mcollina](https://github.com/mcollina)) + +- Added checkout head method and tests [\#347](https://github.com/nodegit/nodegit/pull/347) ([johnhaley81](https://github.com/johnhaley81)) + +- bump devDependencies [\#346](https://github.com/nodegit/nodegit/pull/346) ([PeterDaveHello](https://github.com/PeterDaveHello)) + +- Update dependency node-pre-gyp to ~0.6 [\#345](https://github.com/nodegit/nodegit/pull/345) ([PeterDaveHello](https://github.com/PeterDaveHello)) + +- Update dependency fs-extra to ~0.14.0 [\#343](https://github.com/nodegit/nodegit/pull/343) ([PeterDaveHello](https://github.com/PeterDaveHello)) + +- Add Dependency badge in readme [\#342](https://github.com/nodegit/nodegit/pull/342) ([PeterDaveHello](https://github.com/PeterDaveHello)) + +- Fixed promise chain on install [\#339](https://github.com/nodegit/nodegit/pull/339) ([johnhaley81](https://github.com/johnhaley81)) + +- Do not double free during callbacks. [\#338](https://github.com/nodegit/nodegit/pull/338) ([mcollina](https://github.com/mcollina)) + +- Use svg instead of png to get better image quality [\#337](https://github.com/nodegit/nodegit/pull/337) ([PeterDaveHello](https://github.com/PeterDaveHello)) + +- Update to libgit 0.21.4 [\#336](https://github.com/nodegit/nodegit/pull/336) ([johnhaley81](https://github.com/johnhaley81)) + +- Fix issue 333 [\#334](https://github.com/nodegit/nodegit/pull/334) ([johnhaley81](https://github.com/johnhaley81)) + +- Update appveyor.yml to remove project id [\#324](https://github.com/nodegit/nodegit/pull/324) ([vladikoff](https://github.com/vladikoff)) + +- moving some deps to devdeps [\#320](https://github.com/nodegit/nodegit/pull/320) ([maxkorp](https://github.com/maxkorp)) + +## [v0.2.4](https://github.com/nodegit/nodegit/tree/v0.2.4) (2014-12-05) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.2.3...v0.2.4) + +**Closed issues:** + +- Fetch does not really fetch [\#314](https://github.com/nodegit/nodegit/issues/314) + +- Generate Missing Tests - Unable [\#313](https://github.com/nodegit/nodegit/issues/313) + +- Unable to get reference for HEAD [\#311](https://github.com/nodegit/nodegit/issues/311) + +- nodegit.Signature.now broken [\#306](https://github.com/nodegit/nodegit/issues/306) + +- current branch [\#305](https://github.com/nodegit/nodegit/issues/305) + +- Module fails to load [\#299](https://github.com/nodegit/nodegit/issues/299) + +- How to list all tags? [\#298](https://github.com/nodegit/nodegit/issues/298) + +- Building for ARM [\#292](https://github.com/nodegit/nodegit/issues/292) + +- Next release checklist [\#256](https://github.com/nodegit/nodegit/issues/256) + +**Merged pull requests:** + +- Fixed fetch to be async and use callbacks [\#319](https://github.com/nodegit/nodegit/pull/319) ([johnhaley81](https://github.com/johnhaley81)) + +- Make contributing.md generic and add testing.md [\#318](https://github.com/nodegit/nodegit/pull/318) ([maxkorp](https://github.com/maxkorp)) + +- Fix repo init ext [\#317](https://github.com/nodegit/nodegit/pull/317) ([maxkorp](https://github.com/maxkorp)) + +- Fix 313 generate scripts [\#315](https://github.com/nodegit/nodegit/pull/315) ([xinUmbralis](https://github.com/xinUmbralis)) + +- Fix \#311 [\#312](https://github.com/nodegit/nodegit/pull/312) ([johnhaley81](https://github.com/johnhaley81)) + +- Fix publishing [\#310](https://github.com/nodegit/nodegit/pull/310) ([maxkorp](https://github.com/maxkorp)) + +- detect node-webkit and build with nw-gyp [\#309](https://github.com/nodegit/nodegit/pull/309) ([maxkorp](https://github.com/maxkorp)) + +- fix signature.now and add signature tests [\#308](https://github.com/nodegit/nodegit/pull/308) ([maxkorp](https://github.com/maxkorp)) + +- Add a Gitter chat badge to README.md [\#304](https://github.com/nodegit/nodegit/pull/304) ([gitter-badger](https://github.com/gitter-badger)) + +- move nodegit.js to a template to remove idefs dependency [\#303](https://github.com/nodegit/nodegit/pull/303) ([maxkorp](https://github.com/maxkorp)) + +- Fixed tag list and added a test for it [\#300](https://github.com/nodegit/nodegit/pull/300) ([johnhaley81](https://github.com/johnhaley81)) + +- Convenience methods [\#297](https://github.com/nodegit/nodegit/pull/297) ([johnhaley81](https://github.com/johnhaley81)) + +- Clean up the contents of the generate folder [\#296](https://github.com/nodegit/nodegit/pull/296) ([maxkorp](https://github.com/maxkorp)) + +- Styling [\#295](https://github.com/nodegit/nodegit/pull/295) ([maxkorp](https://github.com/maxkorp)) + +## [v0.2.3](https://github.com/nodegit/nodegit/tree/v0.2.3) (2014-11-25) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.2.2...v0.2.3) + +## [v0.2.2](https://github.com/nodegit/nodegit/tree/v0.2.2) (2014-11-25) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.2.1...v0.2.2) + +**Merged pull requests:** + +- Moved some dependencies around to help the generate not fail [\#294](https://github.com/nodegit/nodegit/pull/294) ([johnhaley81](https://github.com/johnhaley81)) + +## [v0.2.1](https://github.com/nodegit/nodegit/tree/v0.2.1) (2014-11-25) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.2.0...v0.2.1) + +**Merged pull requests:** + +- Rewrite installer [\#293](https://github.com/nodegit/nodegit/pull/293) ([johnhaley81](https://github.com/johnhaley81)) + +## [v0.2.0](https://github.com/nodegit/nodegit/tree/v0.2.0) (2014-11-25) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.1.4...v0.2.0) + +**Closed issues:** + +- Find some way to automatically generate a list of missing tests. [\#272](https://github.com/nodegit/nodegit/issues/272) + +- libgit2 creation methods have name collisions with internal V8 functions [\#271](https://github.com/nodegit/nodegit/issues/271) + +- Enums are still being manually assigned in javascript [\#268](https://github.com/nodegit/nodegit/issues/268) + +- We're using too many promise libraries [\#264](https://github.com/nodegit/nodegit/issues/264) + +- unable to resolve symbolic references [\#262](https://github.com/nodegit/nodegit/issues/262) + +- nodegit installation falls back when Python install dir contains spaces [\#261](https://github.com/nodegit/nodegit/issues/261) + +- Probe features [\#245](https://github.com/nodegit/nodegit/issues/245) + +- require\('path'\).Repo.open\(...\) returns {} [\#241](https://github.com/nodegit/nodegit/issues/241) + +- RevWalk malloc error [\#239](https://github.com/nodegit/nodegit/issues/239) + +- OS X tests in Travis-CI [\#237](https://github.com/nodegit/nodegit/issues/237) + +- Fix RevWalk tests [\#236](https://github.com/nodegit/nodegit/issues/236) + +- Simple clone fails. [\#231](https://github.com/nodegit/nodegit/issues/231) + +- Create templates for remaining src and include files [\#230](https://github.com/nodegit/nodegit/issues/230) + +- Error: SSL is not supported by this copy of libgit2. [\#228](https://github.com/nodegit/nodegit/issues/228) + +- error while install nodegit latest version 0.1.4 [\#225](https://github.com/nodegit/nodegit/issues/225) + +- error while install nodegit latest version 0.1.4 [\#224](https://github.com/nodegit/nodegit/issues/224) + +- Did getReferences dissapear? [\#223](https://github.com/nodegit/nodegit/issues/223) + +- Again for \#147 [\#218](https://github.com/nodegit/nodegit/issues/218) + +- Update documentation on nodegit.org [\#217](https://github.com/nodegit/nodegit/issues/217) + +- Stable = bump to 1.0 [\#215](https://github.com/nodegit/nodegit/issues/215) + +- Example on nodegit.com homepage is invalid [\#211](https://github.com/nodegit/nodegit/issues/211) + +- tree.diffWorkDir deprecated? [\#209](https://github.com/nodegit/nodegit/issues/209) + +- Abort on getRemotes [\#201](https://github.com/nodegit/nodegit/issues/201) + +- Generic Logging/Tracing mechanism [\#199](https://github.com/nodegit/nodegit/issues/199) + +- Repo\#openIndex missing [\#197](https://github.com/nodegit/nodegit/issues/197) + +- Documentation on http://www.nodegit.org/ out of date [\#196](https://github.com/nodegit/nodegit/issues/196) + +- Remove extern "C" with 0.21 bump [\#193](https://github.com/nodegit/nodegit/issues/193) + +- CloneOptions documentation lacking [\#192](https://github.com/nodegit/nodegit/issues/192) + +- Webpage examples are not up to date [\#190](https://github.com/nodegit/nodegit/issues/190) + +- Automatically generate structs from types array [\#187](https://github.com/nodegit/nodegit/issues/187) + +- Error: connect ETIMEDOUT during install [\#179](https://github.com/nodegit/nodegit/issues/179) + +- TODO [\#177](https://github.com/nodegit/nodegit/issues/177) + +- Notes [\#176](https://github.com/nodegit/nodegit/issues/176) + +- Integration improvements. [\#171](https://github.com/nodegit/nodegit/issues/171) + +**Merged pull requests:** + +- add history.md and update readme [\#291](https://github.com/nodegit/nodegit/pull/291) ([maxkorp](https://github.com/maxkorp)) + +- Added tests for commit [\#290](https://github.com/nodegit/nodegit/pull/290) ([nkt](https://github.com/nkt)) + +- Added editor config [\#289](https://github.com/nodegit/nodegit/pull/289) ([nkt](https://github.com/nkt)) + +- \[WIP\] Push example [\#288](https://github.com/nodegit/nodegit/pull/288) ([johnhaley81](https://github.com/johnhaley81)) + +- \[WIP\] Better installation flow [\#287](https://github.com/nodegit/nodegit/pull/287) ([tbranyen](https://github.com/tbranyen)) + +- Merge methods and tests and examples [\#286](https://github.com/nodegit/nodegit/pull/286) ([maxkorp](https://github.com/maxkorp)) + +- Add details-for-tree-entry [\#285](https://github.com/nodegit/nodegit/pull/285) ([johnhaley81](https://github.com/johnhaley81)) + +- Add repo init example [\#284](https://github.com/nodegit/nodegit/pull/284) ([maxkorp](https://github.com/maxkorp)) + +- update add-and-commit example to include new paths [\#283](https://github.com/nodegit/nodegit/pull/283) ([maxkorp](https://github.com/maxkorp)) + +- General cleanup [\#282](https://github.com/nodegit/nodegit/pull/282) ([maxkorp](https://github.com/maxkorp)) + +- Added osx for testing on Travis [\#281](https://github.com/nodegit/nodegit/pull/281) ([johnhaley81](https://github.com/johnhaley81)) + +- Added " around python path to help fix issues with spaces in path [\#280](https://github.com/nodegit/nodegit/pull/280) ([johnhaley81](https://github.com/johnhaley81)) + +- Tests for branch class [\#279](https://github.com/nodegit/nodegit/pull/279) ([johnhaley81](https://github.com/johnhaley81)) + +- Exposes the NodeGit Promise implementation [\#278](https://github.com/nodegit/nodegit/pull/278) ([tbranyen](https://github.com/tbranyen)) + +- Fixes incorrect method used in path lookup [\#277](https://github.com/nodegit/nodegit/pull/277) ([tbranyen](https://github.com/tbranyen)) + +- \[WIP\] Update examples [\#276](https://github.com/nodegit/nodegit/pull/276) ([johnhaley81](https://github.com/johnhaley81)) + +- Added script to generate missing tests [\#274](https://github.com/nodegit/nodegit/pull/274) ([johnhaley81](https://github.com/johnhaley81)) + +- Rename new [\#273](https://github.com/nodegit/nodegit/pull/273) ([maxkorp](https://github.com/maxkorp)) + +- MSBUILD doesn't allow an array of size 0 [\#270](https://github.com/nodegit/nodegit/pull/270) ([johnhaley81](https://github.com/johnhaley81)) + +- \[WIP\] generate enum definitions [\#269](https://github.com/nodegit/nodegit/pull/269) ([maxkorp](https://github.com/maxkorp)) + +- add Refs.nameToId and test [\#267](https://github.com/nodegit/nodegit/pull/267) ([maxkorp](https://github.com/maxkorp)) + +- voidcheck string pointers and reenable attr test [\#266](https://github.com/nodegit/nodegit/pull/266) ([maxkorp](https://github.com/maxkorp)) + +- require --documentation flag to include text in idefs [\#265](https://github.com/nodegit/nodegit/pull/265) ([maxkorp](https://github.com/maxkorp)) + +- This is a test [\#263](https://github.com/nodegit/nodegit/pull/263) ([johnhaley81](https://github.com/johnhaley81)) + +- Added ability for callbacks to poll promises for fulfillment value [\#260](https://github.com/nodegit/nodegit/pull/260) ([johnhaley81](https://github.com/johnhaley81)) + +- Generate nodegit from libgit2 docs and refactor descriptor [\#259](https://github.com/nodegit/nodegit/pull/259) ([johnhaley81](https://github.com/johnhaley81)) + +- Fix revwalk tests [\#258](https://github.com/nodegit/nodegit/pull/258) ([maxkorp](https://github.com/maxkorp)) + +- Bump to latest libgit2 [\#257](https://github.com/nodegit/nodegit/pull/257) ([tbranyen](https://github.com/tbranyen)) + +- Added status methods [\#255](https://github.com/nodegit/nodegit/pull/255) ([tbranyen](https://github.com/tbranyen)) + +- Use Start-Process to start pageant.exe [\#254](https://github.com/nodegit/nodegit/pull/254) ([FeodorFitsner](https://github.com/FeodorFitsner)) + +- Adds in git\_index\_add and GitIndexInfo struct [\#253](https://github.com/nodegit/nodegit/pull/253) ([tbranyen](https://github.com/tbranyen)) + +- Adds in a broken unit test for \#109 [\#252](https://github.com/nodegit/nodegit/pull/252) ([tbranyen](https://github.com/tbranyen)) + +- Added more git\_cred methods [\#251](https://github.com/nodegit/nodegit/pull/251) ([johnhaley81](https://github.com/johnhaley81)) + +- Refactor classes [\#250](https://github.com/nodegit/nodegit/pull/250) ([maxkorp](https://github.com/maxkorp)) + +- Remove openssl [\#249](https://github.com/nodegit/nodegit/pull/249) ([tbranyen](https://github.com/tbranyen)) + +- Update Readme, to improve example code [\#248](https://github.com/nodegit/nodegit/pull/248) ([nmn](https://github.com/nmn)) + +- \[TEST\] Appveyor agent [\#247](https://github.com/nodegit/nodegit/pull/247) ([tbranyen](https://github.com/tbranyen)) + +- Refactor classes [\#246](https://github.com/nodegit/nodegit/pull/246) ([maxkorp](https://github.com/maxkorp)) + +- Buf methods [\#244](https://github.com/nodegit/nodegit/pull/244) ([tbranyen](https://github.com/tbranyen)) + +- Branch methods [\#243](https://github.com/nodegit/nodegit/pull/243) ([tbranyen](https://github.com/tbranyen)) + +- Blame methods [\#242](https://github.com/nodegit/nodegit/pull/242) ([tbranyen](https://github.com/tbranyen)) + +- Enable multios [\#238](https://github.com/nodegit/nodegit/pull/238) ([maxkorp](https://github.com/maxkorp)) + +- Add revwalk.hide and revwalk.simplifyFirstParent [\#235](https://github.com/nodegit/nodegit/pull/235) ([tbranyen](https://github.com/tbranyen)) + +- Add revwalk.hide and revwalk.simplifyFirstParent [\#234](https://github.com/nodegit/nodegit/pull/234) ([orderedlist](https://github.com/orderedlist)) + +- Moved wrapper/copy out of include/src [\#233](https://github.com/nodegit/nodegit/pull/233) ([johnhaley81](https://github.com/johnhaley81)) + +- Removed ejs dependency [\#232](https://github.com/nodegit/nodegit/pull/232) ([johnhaley81](https://github.com/johnhaley81)) + +- Bump to latest libgit2 [\#229](https://github.com/nodegit/nodegit/pull/229) ([tbranyen](https://github.com/tbranyen)) + +- WIP: Refactor source generation templates from EJS to Combyne [\#227](https://github.com/nodegit/nodegit/pull/227) ([tbranyen](https://github.com/tbranyen)) + +- Test fixes [\#226](https://github.com/nodegit/nodegit/pull/226) ([johnhaley81](https://github.com/johnhaley81)) + +- Get HEAD SHA [\#210](https://github.com/nodegit/nodegit/pull/210) ([tbranyen](https://github.com/tbranyen)) + +- Started working on initializing a repo with init options [\#208](https://github.com/nodegit/nodegit/pull/208) ([tbranyen](https://github.com/tbranyen)) + +- Added new methods in checkout and repository [\#207](https://github.com/nodegit/nodegit/pull/207) ([tbranyen](https://github.com/tbranyen)) + +- Added additional remote methods [\#206](https://github.com/nodegit/nodegit/pull/206) ([tbranyen](https://github.com/tbranyen)) + +- Added git\_remote\_url and git\_remote\_load [\#205](https://github.com/nodegit/nodegit/pull/205) ([tbranyen](https://github.com/tbranyen)) + +- Add in remote listing support and test [\#204](https://github.com/nodegit/nodegit/pull/204) ([tbranyen](https://github.com/tbranyen)) + +- Attr methods [\#203](https://github.com/nodegit/nodegit/pull/203) ([tbranyen](https://github.com/tbranyen)) + +- Support latest libgit2 v0.21.0 [\#200](https://github.com/nodegit/nodegit/pull/200) ([tbranyen](https://github.com/tbranyen)) + +- Add Repo.openIndex [\#198](https://github.com/nodegit/nodegit/pull/198) ([tbranyen](https://github.com/tbranyen)) + +- Clone methods [\#195](https://github.com/nodegit/nodegit/pull/195) ([tbranyen](https://github.com/tbranyen)) + +- Remove all unused vendor directories [\#194](https://github.com/nodegit/nodegit/pull/194) ([tbranyen](https://github.com/tbranyen)) + +- \[WIP\] Mocha integration [\#189](https://github.com/nodegit/nodegit/pull/189) ([tbranyen](https://github.com/tbranyen)) + +- Auto gen structs [\#188](https://github.com/nodegit/nodegit/pull/188) ([tbranyen](https://github.com/tbranyen)) + +- Add in support for repository init ext [\#186](https://github.com/nodegit/nodegit/pull/186) ([tbranyen](https://github.com/tbranyen)) + +- moved libgit2 gyp to separate dir [\#184](https://github.com/nodegit/nodegit/pull/184) ([deepak1556](https://github.com/deepak1556)) + +- Remove all generated source code. [\#181](https://github.com/nodegit/nodegit/pull/181) ([tbranyen](https://github.com/tbranyen)) + +- Better installation flow for developing. [\#180](https://github.com/nodegit/nodegit/pull/180) ([tbranyen](https://github.com/tbranyen)) + +- \[Experimental\] Emscripten fun. [\#168](https://github.com/nodegit/nodegit/pull/168) ([tbranyen](https://github.com/tbranyen)) + +## [v0.1.4](https://github.com/nodegit/nodegit/tree/v0.1.4) (2014-06-13) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.1.3...v0.1.4) + +**Closed issues:** + +- Redis Backend [\#173](https://github.com/nodegit/nodegit/issues/173) + +- using "Branch" object results in "undefined" error =\> branch.cc missing from binding.gyp? [\#166](https://github.com/nodegit/nodegit/issues/166) + +- Windows: Failure on install [\#158](https://github.com/nodegit/nodegit/issues/158) + +- Can't install v0.1.2 under OSX [\#155](https://github.com/nodegit/nodegit/issues/155) + +**Merged pull requests:** + +- \[WIP\] Prebuilt binaries. [\#178](https://github.com/nodegit/nodegit/pull/178) ([tbranyen](https://github.com/tbranyen)) + +- NodeJS v0.11.13 compatibility [\#175](https://github.com/nodegit/nodegit/pull/175) ([3y3](https://github.com/3y3)) + +- Fixed: "ReferenceError: error is not defined" [\#169](https://github.com/nodegit/nodegit/pull/169) ([danyshaanan](https://github.com/danyshaanan)) + +## [v0.1.3](https://github.com/nodegit/nodegit/tree/v0.1.3) (2014-05-02) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.1.2...v0.1.3) + +**Merged pull requests:** + +- Fix erroneous OS detection for installation in OS X. [\#156](https://github.com/nodegit/nodegit/pull/156) ([tbranyen](https://github.com/tbranyen)) + +## [v0.1.2](https://github.com/nodegit/nodegit/tree/v0.1.2) (2014-05-02) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.1.1...v0.1.2) + +**Closed issues:** + +- gyp ERR cannot find -lgit2 [\#150](https://github.com/nodegit/nodegit/issues/150) + +- Read file from git server [\#145](https://github.com/nodegit/nodegit/issues/145) + +- "emulate git log" example error [\#144](https://github.com/nodegit/nodegit/issues/144) + +- repo.workdir\(\) crashes \(SIGSEGV\) on a bare repo [\#128](https://github.com/nodegit/nodegit/issues/128) + +- How to create Branch using the API? [\#124](https://github.com/nodegit/nodegit/issues/124) + +- 'npm run-script gen && npm install' on Ubuntu 13.04 [\#122](https://github.com/nodegit/nodegit/issues/122) + +- Error while installing Nodegit 0.1.0 [\#120](https://github.com/nodegit/nodegit/issues/120) + +- Question: How would I implement the equivalent of `git status`? [\#117](https://github.com/nodegit/nodegit/issues/117) + +- Sync versions of all the methods [\#115](https://github.com/nodegit/nodegit/issues/115) + +- Tick version \# [\#107](https://github.com/nodegit/nodegit/issues/107) + +- Windows support [\#71](https://github.com/nodegit/nodegit/issues/71) + +- Create test for history with merge commits [\#64](https://github.com/nodegit/nodegit/issues/64) + +**Merged pull requests:** + +- Fixed OSX Directions [\#143](https://github.com/nodegit/nodegit/pull/143) ([nickpoorman](https://github.com/nickpoorman)) + +- Add ubuntu lib dependencies to the readme [\#141](https://github.com/nodegit/nodegit/pull/141) ([bigthyme](https://github.com/bigthyme)) + +- WIP New installer. [\#140](https://github.com/nodegit/nodegit/pull/140) ([tbranyen](https://github.com/tbranyen)) + +## [v0.1.1](https://github.com/nodegit/nodegit/tree/v0.1.1) (2014-03-23) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.1.0...v0.1.1) + +**Closed issues:** + +- Misleading Readme [\#138](https://github.com/nodegit/nodegit/issues/138) + +- Cannot find module './build/Debug/nodegit' [\#137](https://github.com/nodegit/nodegit/issues/137) + +- Support for Node 0.11+ [\#134](https://github.com/nodegit/nodegit/issues/134) + +- installer cant seem to find python [\#126](https://github.com/nodegit/nodegit/issues/126) + +- Cannot build when parent directory contains space\(s\) [\#123](https://github.com/nodegit/nodegit/issues/123) + +- question: how cvv8 is used? [\#118](https://github.com/nodegit/nodegit/issues/118) + +- question: gen.js does not generate wrapper.h and wrapper.cc [\#116](https://github.com/nodegit/nodegit/issues/116) + +- tree.diffIndex: pointer being freed was not allocated [\#112](https://github.com/nodegit/nodegit/issues/112) + +- Use as a dependency of another node project? [\#110](https://github.com/nodegit/nodegit/issues/110) + +- Segmentation faults with concurrent access? [\#104](https://github.com/nodegit/nodegit/issues/104) + +- tree.diffWorkDir [\#101](https://github.com/nodegit/nodegit/issues/101) + +- getReference passes unexpected object into callback [\#98](https://github.com/nodegit/nodegit/issues/98) + +- index.removeByPath stops execution [\#97](https://github.com/nodegit/nodegit/issues/97) + +- Missing example: commit to a local repo \(i.e. git add, git commit\) [\#96](https://github.com/nodegit/nodegit/issues/96) + +- Get contents of index entry? [\#94](https://github.com/nodegit/nodegit/issues/94) + +- Failure to Build nodegit at Commit 0aa9a3c120 on OS X 10.6.8 [\#92](https://github.com/nodegit/nodegit/issues/92) + +- TypeError: Cannot call method 'clone' of undefined [\#91](https://github.com/nodegit/nodegit/issues/91) + +- missing cstring [\#88](https://github.com/nodegit/nodegit/issues/88) + +- Installing fails - can't find vendor/libgit2/build [\#80](https://github.com/nodegit/nodegit/issues/80) + +- Improving JavaScript API [\#73](https://github.com/nodegit/nodegit/issues/73) + +- Using code-generation to generate [\#70](https://github.com/nodegit/nodegit/issues/70) + +**Merged pull requests:** + +- Fix and improve testing. [\#139](https://github.com/nodegit/nodegit/pull/139) ([tbranyen](https://github.com/tbranyen)) + +- Support for Node 0.11+ [\#135](https://github.com/nodegit/nodegit/pull/135) ([pierreinglebert](https://github.com/pierreinglebert)) + +- Fixed the error message to pass test. [\#119](https://github.com/nodegit/nodegit/pull/119) ([tbranyen](https://github.com/tbranyen)) + +- Added git\_diff\_delta\_dup to git\_diff\_get\_patch to fix a memory issue whe... [\#113](https://github.com/nodegit/nodegit/pull/113) ([kmctown](https://github.com/kmctown)) + +- Try requiring build/Debug/nodegit if build/Release/nodegit wasn't found. [\#108](https://github.com/nodegit/nodegit/pull/108) ([papandreou](https://github.com/papandreou)) + +- Updated v0.18.0.json to make the index and DiffOptions arguments in Inde... [\#106](https://github.com/nodegit/nodegit/pull/106) ([kmctown](https://github.com/kmctown)) + +- Duplicate git\_error struct before passing it on [\#105](https://github.com/nodegit/nodegit/pull/105) ([papandreou](https://github.com/papandreou)) + +- Changed v0.18.0.json so diffWorkDir DiffOptions argument is optional. Ad... [\#103](https://github.com/nodegit/nodegit/pull/103) ([kmctown](https://github.com/kmctown)) + +- Reviewd and fixed examples [\#102](https://github.com/nodegit/nodegit/pull/102) ([micha149](https://github.com/micha149)) + +- cmake 2.8 is required to build nodegit [\#100](https://github.com/nodegit/nodegit/pull/100) ([dcolens](https://github.com/dcolens)) + +- new add-and-commit.js and remove-and-commit.js examples [\#99](https://github.com/nodegit/nodegit/pull/99) ([dcolens](https://github.com/dcolens)) + +- Add missing fields to index entry [\#95](https://github.com/nodegit/nodegit/pull/95) ([papandreou](https://github.com/papandreou)) + +- Made the tests pass and making each test self-contained [\#90](https://github.com/nodegit/nodegit/pull/90) ([FrozenCow](https://github.com/FrozenCow)) + +- Fixed compile error: memcpy not defined [\#89](https://github.com/nodegit/nodegit/pull/89) ([FrozenCow](https://github.com/FrozenCow)) + +- Add system dependencies for OSX install [\#82](https://github.com/nodegit/nodegit/pull/82) ([philschatz](https://github.com/philschatz)) + +## [v0.1.0](https://github.com/nodegit/nodegit/tree/v0.1.0) (2013-09-07) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.79...v0.1.0) + +**Closed issues:** + +- The api in README is incorrect [\#87](https://github.com/nodegit/nodegit/issues/87) + +- message\_encoding in documentation for Repo.createCommit [\#86](https://github.com/nodegit/nodegit/issues/86) + +- How to retrieve blob with binary content? [\#83](https://github.com/nodegit/nodegit/issues/83) + +- Incorrect commit oid's when aggregated from commit.history\(\) [\#81](https://github.com/nodegit/nodegit/issues/81) + +- How do you list branches in repo? [\#76](https://github.com/nodegit/nodegit/issues/76) + +- License? [\#74](https://github.com/nodegit/nodegit/issues/74) + +- Nested walks scatter memory and cause SEGFAULTS [\#72](https://github.com/nodegit/nodegit/issues/72) + +- feature request: Provide fileMode / getType method on tree entries [\#67](https://github.com/nodegit/nodegit/issues/67) + +- Document DiffList [\#66](https://github.com/nodegit/nodegit/issues/66) + +- Procedure for moving development to nodegit/nodegit [\#55](https://github.com/nodegit/nodegit/issues/55) + +- Cannot install on OSX [\#49](https://github.com/nodegit/nodegit/issues/49) + +**Merged pull requests:** + +- Fixed TreeBuilder.write's missing repo argument to match its documentation [\#85](https://github.com/nodegit/nodegit/pull/85) ([FrozenCow](https://github.com/FrozenCow)) + +- Codegen [\#79](https://github.com/nodegit/nodegit/pull/79) ([nkallen](https://github.com/nkallen)) + +- Codegen [\#78](https://github.com/nodegit/nodegit/pull/78) ([nkallen](https://github.com/nkallen)) + +- Codegen [\#77](https://github.com/nodegit/nodegit/pull/77) ([nkallen](https://github.com/nkallen)) + +- Updated LICENSE to MIT [\#75](https://github.com/nodegit/nodegit/pull/75) ([tbranyen](https://github.com/tbranyen)) + +## [v0.0.79](https://github.com/nodegit/nodegit/tree/v0.0.79) (2013-04-05) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.778...v0.0.79) + +**Closed issues:** + +- Clarify commit.history documentation [\#63](https://github.com/nodegit/nodegit/issues/63) + +- Python error on installing nodegit 0.0.77 [\#59](https://github.com/nodegit/nodegit/issues/59) + +## [v0.0.778](https://github.com/nodegit/nodegit/tree/v0.0.778) (2013-03-26) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.77...v0.0.778) + +**Merged pull requests:** + +- See issue \#59 [\#60](https://github.com/nodegit/nodegit/pull/60) ([dctr](https://github.com/dctr)) + +## [v0.0.77](https://github.com/nodegit/nodegit/tree/v0.0.77) (2013-03-24) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.76...v0.0.77) + +## [v0.0.76](https://github.com/nodegit/nodegit/tree/v0.0.76) (2013-03-24) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.75...v0.0.76) + +## [v0.0.75](https://github.com/nodegit/nodegit/tree/v0.0.75) (2013-03-24) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.74...v0.0.75) + +**Closed issues:** + +- incomplete error reporting [\#57](https://github.com/nodegit/nodegit/issues/57) + +- Segmentation Fault in raw-commit.js [\#56](https://github.com/nodegit/nodegit/issues/56) + +- Another Mac OSX install fail [\#53](https://github.com/nodegit/nodegit/issues/53) + +- unit tests broken in travis-ci [\#52](https://github.com/nodegit/nodegit/issues/52) + +- "Image not found" with require\("nodegit"\) on Mac OS X [\#51](https://github.com/nodegit/nodegit/issues/51) + +- Cannot Compile on 0.8.\* [\#47](https://github.com/nodegit/nodegit/issues/47) + +- No suitable image found. [\#46](https://github.com/nodegit/nodegit/issues/46) + +- Fails to require module on latest node version [\#43](https://github.com/nodegit/nodegit/issues/43) + +- Compilation error node 0.6.1 [\#32](https://github.com/nodegit/nodegit/issues/32) + +- commit.history work like slice [\#17](https://github.com/nodegit/nodegit/issues/17) + +- Sync and Async methods [\#16](https://github.com/nodegit/nodegit/issues/16) + +- Comment all code methods [\#1](https://github.com/nodegit/nodegit/issues/1) + +## [v0.0.74](https://github.com/nodegit/nodegit/tree/v0.0.74) (2013-03-21) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.73...v0.0.74) + +## [v0.0.73](https://github.com/nodegit/nodegit/tree/v0.0.73) (2013-03-21) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.72...v0.0.73) + +**Closed issues:** + +- pass through python flag to node-gyp [\#54](https://github.com/nodegit/nodegit/issues/54) + +- update package.json [\#28](https://github.com/nodegit/nodegit/issues/28) + +- Rewrite Notes [\#27](https://github.com/nodegit/nodegit/issues/27) + +- Tree each method is synchronous [\#15](https://github.com/nodegit/nodegit/issues/15) + +## [v0.0.72](https://github.com/nodegit/nodegit/tree/v0.0.72) (2013-03-06) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.71...v0.0.72) + +## [v0.0.71](https://github.com/nodegit/nodegit/tree/v0.0.71) (2013-03-06) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.6...v0.0.71) + +**Closed issues:** + +- Unable to load shared library [\#39](https://github.com/nodegit/nodegit/issues/39) + +- Expand Convenience Unit Tests [\#38](https://github.com/nodegit/nodegit/issues/38) + +- repo has no method 'branch' [\#35](https://github.com/nodegit/nodegit/issues/35) + +- update for node 0.5.9 [\#29](https://github.com/nodegit/nodegit/issues/29) + +**Merged pull requests:** + +- Converted from eio\_custom to uv\_queue\_work [\#48](https://github.com/nodegit/nodegit/pull/48) ([faceleg](https://github.com/faceleg)) + +- Fix Load-Order Bug [\#44](https://github.com/nodegit/nodegit/pull/44) ([fatlotus](https://github.com/fatlotus)) + +- Update documented commands needed to run tests [\#42](https://github.com/nodegit/nodegit/pull/42) ([shama](https://github.com/shama)) + +- Fix typo in README.md [\#41](https://github.com/nodegit/nodegit/pull/41) ([Skomski](https://github.com/Skomski)) + +- Issue 35: repo has no method 'branch' [\#40](https://github.com/nodegit/nodegit/pull/40) ([cholin](https://github.com/cholin)) + +- Refactor [\#37](https://github.com/nodegit/nodegit/pull/37) ([mmalecki](https://github.com/mmalecki)) + +- Refactor [\#36](https://github.com/nodegit/nodegit/pull/36) ([mmalecki](https://github.com/mmalecki)) + +- Removed references to node\_events.h [\#31](https://github.com/nodegit/nodegit/pull/31) ([alexkwolfe](https://github.com/alexkwolfe)) + +- Updates for node 0.5.9 \(fixed Issue \#29\) [\#30](https://github.com/nodegit/nodegit/pull/30) ([tojocky](https://github.com/tojocky)) + +- Error constants added [\#25](https://github.com/nodegit/nodegit/pull/25) ([milani](https://github.com/milani)) + +## [v0.0.6](https://github.com/nodegit/nodegit/tree/v0.0.6) (2011-12-19) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.4...v0.0.6) + +**Closed issues:** + +- commit event with undefined commit [\#26](https://github.com/nodegit/nodegit/issues/26) + +- Convenience methods are not convenience! [\#24](https://github.com/nodegit/nodegit/issues/24) + +**Merged pull requests:** + +- Node 0.6x fixes [\#34](https://github.com/nodegit/nodegit/pull/34) ([moneal](https://github.com/moneal)) + +- Updates for node 0.6x [\#33](https://github.com/nodegit/nodegit/pull/33) ([moneal](https://github.com/moneal)) + +## [v0.0.4](https://github.com/nodegit/nodegit/tree/v0.0.4) (2011-05-14) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.3...v0.0.4) + +**Closed issues:** + +- repo.branch fails on empty repo [\#22](https://github.com/nodegit/nodegit/issues/22) + +- example/convenience-repo.js errors [\#21](https://github.com/nodegit/nodegit/issues/21) + +- Branch history each method is asynchronous [\#11](https://github.com/nodegit/nodegit/issues/11) + +## [v0.0.3](https://github.com/nodegit/nodegit/tree/v0.0.3) (2011-04-13) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.2...v0.0.3) + +**Closed issues:** + +- error handling [\#18](https://github.com/nodegit/nodegit/issues/18) + +- Windows link issue [\#12](https://github.com/nodegit/nodegit/issues/12) + +## [v0.0.2](https://github.com/nodegit/nodegit/tree/v0.0.2) (2011-03-14) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.0.1...v0.0.2) + +## [v0.0.1](https://github.com/nodegit/nodegit/tree/v0.0.1) (2011-03-10) + + + +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/README.md b/README.md index 142085be1..f01f8710a 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ NodeGit Linux OS X Windows + Coverage Dependencies @@ -20,6 +21,9 @@ NodeGit + + Coverage Status + @@ -27,14 +31,11 @@ NodeGit -***NOTE: NodeGit currently does not work with [iojs on windows](https://github.com/rvagg/pangyp/issues/4)*** - -**Stable: 0.3.3** +**Stable: 0.4.0** ## Have a problem? Come chat with us! ## -[![Gitter](http://www.nodegit.org/img/gitterbadge.svg)] -(https://gitter.im/nodegit/nodegit) +[![Gitter](http://www.nodegit.org/img/gitterbadge.svg)](https://gitter.im/nodegit/nodegit) ## Maintained by ## Tim Branyen [@tbranyen](http://twitter.com/tbranyen), @@ -60,6 +61,8 @@ dependencies. npm install nodegit ``` +**Note: NodeGit will only work on io.js Windows with [the iojs binary instead of node](https://github.com/rvagg/pangyp/issues/4).** + If you encounter problems while installing, you should try the Building from source instructions below. @@ -91,7 +94,7 @@ clone("https://github.com/nodegit/nodegit", "tmp", null) }) // Display information about the blob. .then(function(blob) { - // Show the name, sha, and filesize in byes. + // Show the name, sha, and filesize in bytes. console.log(blob.entry.name() + blob.entry.sha() + blob.size() + "b"); // Show a spacer. diff --git a/examples/cloneFromGithubWith2Factor.js b/examples/cloneFromGithubWith2Factor.js index 8c8ca0829..20cda9a46 100644 --- a/examples/cloneFromGithubWith2Factor.js +++ b/examples/cloneFromGithubWith2Factor.js @@ -19,8 +19,6 @@ var repoUrl = "https://" + token + repoOwner + "/" + repoName + ".git"; -var opts = { ignoreCertErrors: 1}; - // If the repo is public, you can use a callback instead var repoUrl = "https://github.com/" + repoOwner + "/" + repoName + ".git"; diff --git a/generate/input/callbacks.json b/generate/input/callbacks.json index 46dbb4654..d9f0af8d9 100644 --- a/generate/input/callbacks.json +++ b/generate/input/callbacks.json @@ -180,10 +180,6 @@ "name": "hunk", "cType": "const git_diff_hunk *" }, - { - "name": "line", - "cType": "const git_diff_line *" - }, { "name": "payload", "cType": "void *" @@ -273,7 +269,11 @@ "git_note_foreach_cb": { "args": [ { - "name": "id", + "name": "blob_id", + "cType": "const git_oid *" + }, + { + "name": "annotated_object_id", "cType": "const git_oid *" }, { @@ -283,7 +283,7 @@ ], "return": { "type": "int", - "noResults": 1, + "noResults": 0, "success": 0, "error": -1 } @@ -371,9 +371,9 @@ ], "return": { "type": "int", - "noResults": 1, + "noResults": 0, "success": 0, - "error": -1 + "error": 1 } }, "git_repository_mergehead_foreach_cb": { @@ -389,9 +389,9 @@ ], "return": { "type": "int", - "noResults": 1, + "noResults": 0, "success": 0, - "error": -1 + "error": 1 } }, "git_revwalk_hide_cb": { @@ -424,7 +424,7 @@ }, { "name": "stash_id", - "cType": "const int *" + "cType": "const git_oid *" }, { "name": "payload", @@ -433,7 +433,7 @@ ], "return": { "type": "int", - "noResults": 1, + "noResults":0, "success": 0, "error": -1 } diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index bb3a71a28..05938ae73 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -173,7 +173,10 @@ } }, "git_branch_upstream": { - "isAsync": false + "isAsync": false, + "return" : { + "isErrorCode": true + } } } }, @@ -385,7 +388,10 @@ "ignore": true }, "git_config_get_string": { - "ignore": true + "isAsync": true, + "return": { + "isErrorCode": true + } }, "git_config_iterator_free": { "ignore": true @@ -412,7 +418,10 @@ "ignore": true }, "git_config_open_default": { - "ignore": true + "isAsync": true, + "return": { + "isErrorCode": true + } }, "git_config_open_global": { "ignore": true @@ -440,6 +449,12 @@ }, "git_config_set_int32": { "ignore": true + }, + "git_config_set_string": { + "isAsync": true, + "return": { + "isErrorCode": true + } } } }, @@ -509,7 +524,39 @@ ], "functions": { "git_diff_blob_to_buffer": { - "ignore": true + "args": { + "old_blob" : { + "isOptional": true + }, + "old_as_path" : { + "isOptional": true + }, + "buffer" : { + "isOptional": true + }, + "buffer_len" : { + "isOptional": true + }, + "buffer_as_path" : { + "isOptional": true + }, + "options" : { + "isOptional": true + }, + "file_cb" : { + "isOptional": true + }, + "hunk_cb" : { + "isOptional": true + }, + "line_cb" : { + "isOptional": true + } + }, + "return": { + "isErrorCode": true + }, + "isAsync": true }, "git_diff_blobs": { "ignore": true @@ -743,7 +790,20 @@ "graph": { "functions": { "git_graph_ahead_behind": { - "ignore": true + "args": { + "ahead": { + "shouldAlloc": true, + "isReturn": true + }, + "behind": { + "shouldAlloc": true, + "isReturn": true + } + }, + "isAsync": true, + "return": { + "isErrorCode": true + } } } }, @@ -944,8 +1004,17 @@ } } }, + "git_note_remove": { + "isAsync": true, + "return": { + "isErrorCode": true + } + }, "git_note_foreach": { - "ignore": true + "isAsync": true, + "return": { + "isErrorCode": true + } } } }, @@ -1079,7 +1148,11 @@ "shouldAlloc": true, "functions": { "git_oid_cpy": { - "ignore": true + "args": { + "out": { + "isReturn": true + } + } }, "git_oid_fmt": { "ignore": true @@ -1132,7 +1205,7 @@ "ignore": true }, "git_packbuilder_new": { - "ignore": true + "isAsync": false }, "git_packbuilder_set_callbacks": { "ignore": true @@ -1182,6 +1255,9 @@ "functions": { "git_pathspec_match_list_free": { "ignore": true + }, + "git_pathspec_new": { + "isAsync": false } } }, @@ -1306,6 +1382,9 @@ "remote": { "cType": "git_remote", "functions": { + "git_remote_create": { + "isAsync": false + }, "git_remote_connect": { "isAsync": true, "return": { @@ -1329,6 +1408,12 @@ "git_remote_default_branch": { "ignore": true }, + "git_remote_delete": { + "isAsync": true, + "return": { + "isErrorCode": true + } + }, "git_remote_fetch": { "args": { "reflog_message": { @@ -1450,7 +1535,10 @@ "ignore": true }, "git_repository_fetchhead_foreach": { - "ignore": true + "isAsync": true, + "return": { + "isErrorCode": true + } }, "git_repository_hashfile": { "ignore": true @@ -1564,7 +1652,10 @@ "stash": { "functions": { "git_stash_foreach": { - "ignore": true + "isAsync": true, + "return": { + "isErrorCode": true + } } } }, @@ -1576,6 +1667,16 @@ "git_status_byindex": { "isAsync": false }, + "git_status_file": { + "args": { + "status_flags": { + "isReturn": true + }, + "return": { + "isErrorCode": true + } + } + }, "git_status_foreach": { "isAsync": true, "return": { @@ -1596,7 +1697,7 @@ "status_list": { "functions": { "git_status_list_new": { - "isAsync": true, + "isAsync": false, "args": { "opts": { "isOptional": true diff --git a/generate/input/libgit2-supplement.json b/generate/input/libgit2-supplement.json index f1553d80a..3940797b1 100644 --- a/generate/input/libgit2-supplement.json +++ b/generate/input/libgit2-supplement.json @@ -141,6 +141,36 @@ "type": "int" }, "group": "reset" + }, + "git_stash_save": { + "type": "function", + "file": "stash.h", + "args": [ + { + "name": "out", + "type": "git_oid *" + }, + { + "name": "repo", + "type": "git_repository *" + }, + { + "name": "stasher", + "type": "const git_signature *" + }, + { + "name": "message", + "type": "const char *" + }, + { + "name": "flags", + "type": "unsigned int" + } + ], + "return": { + "type": "int" + }, + "group": "stash" } }, "groups": [ @@ -470,6 +500,9 @@ "groups": { "reset": [ "git_reset" + ], + "stash": [ + "git_stash_save" ] } } diff --git a/generate/input/v0.22.1.json b/generate/input/v0.22.2.json similarity index 100% rename from generate/input/v0.22.1.json rename to generate/input/v0.22.2.json diff --git a/generate/scripts/generateNativeCode.js b/generate/scripts/generateNativeCode.js index 3774d1d56..a8efec20d 100644 --- a/generate/scripts/generateNativeCode.js +++ b/generate/scripts/generateNativeCode.js @@ -56,7 +56,7 @@ module.exports = function generateNativeCode() { defaultValue: require("../templates/filters/default_value"), fieldsInfo: require("../templates/filters/fields_info"), hasReturnType: require("../templates/filters/has_return_type"), - hasReturns: require("../templates/filters/has_returns"), + hasReturnValue: require("../templates/filters/has_return_value"), isDoublePointer: require("../templates/filters/is_double_pointer"), isFixedLengthString: require("../templates/filters/is_fixed_length_string"), isOid: require("../templates/filters/is_oid"), @@ -110,20 +110,13 @@ module.exports = function generateNativeCode() { utils.writeFile("../lib/nodegit.js", beautify(templates.nodegitJS.render(enabled))); // Write out all the classes. enabled.forEach(function(idef) { - try { - if (idef.type && idef.type != "enum") { - utils.writeFile( - "../src/" + idef.filename + ".cc", templates[idef.type + "_content"].render(idef) - ); - utils.writeFile( - "../include/" + idef.filename + ".h", templates[idef.type + "_header"].render(idef) - ); - } - } - catch (e) { - if (process.env.BUILD_ONLY) { - console.error(e); - } + if (idef.type && idef.type != "enum") { + utils.writeFile( + "../src/" + idef.filename + ".cc", templates[idef.type + "_content"].render(idef) + ); + utils.writeFile( + "../include/" + idef.filename + ".h", templates[idef.type + "_header"].render(idef) + ); } }); diff --git a/generate/templates/filters/has_return_value.js b/generate/templates/filters/has_return_value.js new file mode 100644 index 000000000..bbe371808 --- /dev/null +++ b/generate/templates/filters/has_return_value.js @@ -0,0 +1,9 @@ +module.exports = function(fn) { + if (fn.return + && !fn.return.isErrorCode + && fn.return.cType != "void") { + return true + } + + return false; +}; diff --git a/generate/templates/filters/has_returns.js b/generate/templates/filters/has_returns.js deleted file mode 100644 index 733bfe6a3..000000000 --- a/generate/templates/filters/has_returns.js +++ /dev/null @@ -1,15 +0,0 @@ -module.exports = function(fn) { - var args = fn.args || []; - var result = args.some(function (arg) { - return arg.isReturn; - }); - - if (!result - && fn.return - && !fn.return.isErrorCode - && fn.return.cType != "void") { - result = true; - } - - return result || (fn.return && fn.return.isErrorCode); -}; diff --git a/generate/templates/filters/returns_info.js b/generate/templates/filters/returns_info.js index ff36e0c51..7eaf26e7a 100644 --- a/generate/templates/filters/returns_info.js +++ b/generate/templates/filters/returns_info.js @@ -1,3 +1,5 @@ +var isPointer = require("./is_pointer"); + module.exports = function(fn, argReturnsOnly, isAsync) { var result = []; var args = fn.args || []; @@ -11,6 +13,10 @@ module.exports = function(fn, argReturnsOnly, isAsync) { return_info.parsedName = isAsync ? "baton->" + return_info.name : return_info.name; return_info.isCppClassIntType = ~['Uint32', 'Int32'].indexOf(return_info.cppClassName); + return_info.needsDereference + = isAsync && + return_info.cppClassName == "Number" && + isPointer(return_info.cType); return_info.parsedClassName = (return_info.cppClassName || '').toLowerCase() + "_t"; return_info.returnNameOrName = return_info.returnName || return_info.name; return_info.jsOrCppClassName = return_info.jsClassName || return_info.cppClassName; diff --git a/generate/templates/manual/src/functions/copy.cc b/generate/templates/manual/src/functions/copy.cc index 0effadb2c..a7b59c199 100644 --- a/generate/templates/manual/src/functions/copy.cc +++ b/generate/templates/manual/src/functions/copy.cc @@ -9,39 +9,3 @@ const git_error *git_error_dup(const git_error *arg) { result->message = strdup(arg->message); return result; } - -const git_oid *git_oid_dup(const git_oid *arg) { - git_oid *result = (git_oid *)malloc(sizeof(git_oid)); - git_oid_cpy(result, arg); - return result; -} - -const git_index_entry *git_index_entry_dup(const git_index_entry *arg) { - git_index_entry *result = (git_index_entry *)malloc(sizeof(git_index_entry)); - *result = *arg; - return result; -} - -const git_index_time *git_index_time_dup(const git_index_time *arg) { - git_index_time *result = (git_index_time *)malloc(sizeof(git_index_time)); - *result = (const git_index_time) *arg; - return result; -} - -const git_time *git_time_dup(const git_time *arg) { - git_time *result = (git_time *)malloc(sizeof(git_time)); - *result = *arg; - return result; -} - -const git_diff_delta *git_diff_delta_dup(const git_diff_delta *arg) { - git_diff_delta *result = (git_diff_delta *)malloc(sizeof(git_diff_delta)); - *result = *arg; - return result; -} - -const git_diff_file *git_diff_file_dup(const git_diff_file *arg) { - git_diff_file *result = (git_diff_file *)malloc(sizeof(git_diff_file)); - *result = *arg; - return result; -} diff --git a/generate/templates/partials/callback_helpers.cc b/generate/templates/partials/callback_helpers.cc index f5bc67f71..8c1d34651 100644 --- a/generate/templates/partials/callback_helpers.cc +++ b/generate/templates/partials/callback_helpers.cc @@ -80,6 +80,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}_{{ cbFunction.name }}_async(uv_as NanAssignPersistent(baton->promise, promise); + uv_close((uv_handle_t*) &baton->req, NULL); uv_async_init(uv_default_loop(), &baton->req, (uv_async_cb) {{ cppFunctionName }}_{{ cbFunction.name }}_asyncPromisePolling); uv_async_send(&baton->req); return; @@ -110,7 +111,9 @@ void {{ cppClassName }}::{{ cppFunctionName }}_{{ cbFunction.name }}_async(uv_as baton->result = {{ cbFunction.return.noResults }}; } {% endeach %} + baton->done = true; + uv_close((uv_handle_t*) &baton->req, NULL); } void {{ cppClassName }}::{{ cppFunctionName }}_{{ cbFunction.name }}_asyncPromisePolling(uv_async_t* req, int status) { @@ -120,7 +123,7 @@ void {{ cppClassName }}::{{ cppFunctionName }}_{{ cbFunction.name }}_asyncPromis Local promise = NanNew(baton->promise); NanCallback* isPendingFn = new NanCallback(promise->Get(NanNew("isPending")).As()); Local argv[1]; // MSBUILD won't assign an array of length 0 - Local isPending = isPendingFn->Call(0, argv)->ToBoolean(); + Local isPending = isPendingFn->Call(promise, 0, argv)->ToBoolean(); if (isPending->Value()) { uv_async_send(&baton->req); @@ -128,11 +131,11 @@ void {{ cppClassName }}::{{ cppFunctionName }}_{{ cbFunction.name }}_asyncPromis } NanCallback* isFulfilledFn = new NanCallback(promise->Get(NanNew("isFulfilled")).As()); - Local isFulfilled = isFulfilledFn->Call(0, argv)->ToBoolean(); + Local isFulfilled = isFulfilledFn->Call(promise, 0, argv)->ToBoolean(); if (isFulfilled->Value()) { NanCallback* resultFn = new NanCallback(promise->Get(NanNew("value")).As()); - Handle result = resultFn->Call(0, argv); + Handle result = resultFn->Call(promise, 0, argv); {% each cbFunction|returnsInfo false true as _return %} if (result.IsEmpty() || result->IsNativeError()) { @@ -165,6 +168,8 @@ void {{ cppClassName }}::{{ cppFunctionName }}_{{ cbFunction.name }}_asyncPromis baton->result = {{ cbFunction.return.error }}; baton->done = false; } + + uv_close((uv_handle_t*) &baton->req, NULL); } {%endif%} {%endeach%} diff --git a/generate/templates/partials/convert_to_v8.cc b/generate/templates/partials/convert_to_v8.cc index 1d2053791..aba2d9c97 100644 --- a/generate/templates/partials/convert_to_v8.cc +++ b/generate/templates/partials/convert_to_v8.cc @@ -22,7 +22,7 @@ {% if isCppClassIntType %} to = NanNew<{{ cppClassName }}>(({{ parsedClassName }}){{= parsedName =}}); {% else %} - to = NanNew<{{ cppClassName }}>({{= parsedName =}}); + to = NanNew<{{ cppClassName }}>({% if needsDereference %}*{% endif %}{{= parsedName =}}); {% endif %} {% elsif cppClassName == 'External' %} diff --git a/generate/templates/partials/field_accessors.cc b/generate/templates/partials/field_accessors.cc index f5f3aa448..03131d6ba 100644 --- a/generate/templates/partials/field_accessors.cc +++ b/generate/templates/partials/field_accessors.cc @@ -173,6 +173,7 @@ NanAssignPersistent(baton->promise, promise); + uv_close((uv_handle_t*) &baton->req, NULL); uv_async_init(uv_default_loop(), &baton->req, (uv_async_cb) {{ field.name }}_asyncPromisePolling); uv_async_send(&baton->req); return; @@ -204,6 +205,7 @@ } {% endeach %} baton->done = true; + uv_close((uv_handle_t*) &baton->req, NULL); } void {{ cppClassName }}::{{ field.name }}_asyncPromisePolling(uv_async_t* req, int status) { @@ -213,7 +215,7 @@ Local promise = NanNew(baton->promise); NanCallback* isPendingFn = new NanCallback(promise->Get(NanNew("isPending")).As()); Local argv[1]; // MSBUILD won't assign an array of length 0 - Local isPending = isPendingFn->Call(0, argv)->ToBoolean(); + Local isPending = isPendingFn->Call(promise, 0, argv)->ToBoolean(); if (isPending->Value()) { uv_async_send(&baton->req); @@ -221,11 +223,11 @@ } NanCallback* isFulfilledFn = new NanCallback(promise->Get(NanNew("isFulfilled")).As()); - Local isFulfilled = isFulfilledFn->Call(0, argv)->ToBoolean(); + Local isFulfilled = isFulfilledFn->Call(promise, 0, argv)->ToBoolean(); if (isFulfilled->Value()) { NanCallback* resultFn = new NanCallback(promise->Get(NanNew("value")).As()); - Handle result = resultFn->Call(0, argv); + Handle result = resultFn->Call(promise, 0, argv); {% each field|returnsInfo false true as _return %} if (result.IsEmpty() || result->IsNativeError()) { @@ -258,6 +260,8 @@ baton->result = {{ field.return.error }}; baton->done = false; } + + uv_close((uv_handle_t*) &baton->req, NULL); } {% endif %} {% endif %} diff --git a/generate/templates/partials/sync_function.cc b/generate/templates/partials/sync_function.cc index 136f8427c..cf9ab11f2 100644 --- a/generate/templates/partials/sync_function.cc +++ b/generate/templates/partials/sync_function.cc @@ -36,7 +36,7 @@ NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) { if (ObjectWrap::Unwrap<{{ cppClassName }}>(args.This())->GetValue() != NULL) { {% endif %} -{%if .|hasReturns %} +{%if .|hasReturnValue %} {{ return.cType }} result = {%endif%}{{ cFunctionName }}( {%each args|argsInfo as arg %} {%if arg.isReturn %} @@ -53,7 +53,7 @@ from_{{ arg.name }} {%endeach%} ); -{%if return.isErrorCode %} +{%if .|hasReturnValue |and return.isErrorCode %} if (result != GIT_OK) { {%each args|argsInfo as arg %} {%if arg.shouldAlloc %} @@ -82,7 +82,7 @@ from_{{ arg.name }} {%each args|argsInfo as arg %} {%if arg | isOid %} if (args[{{ arg.jsArg }}]->IsString()) { - free(&from_{{ arg.name }}); + free((void *)from_{{ arg.name }}); } {%endif%} {%endeach%} diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index 06adb5307..ed13a69f8 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -9,6 +9,10 @@ "<(module_root_dir)/vendor/libgit2.gyp:libgit2" ], + "variables": { + "coverage%": 0 + }, + "sources": [ "src/nodegit.cc", "src/wrapper.cc", @@ -32,6 +36,19 @@ ], "conditions": [ + [ + "coverage==1", { + "cflags": [ + "-ftest-coverage", + "-fprofile-arcs" + ], + "link_settings": { + "libraries": [ + "-lgcov" + ] + }, + } + ], [ "OS=='mac'", { "xcode_settings": { diff --git a/generate/templates/templates/nodegit.js b/generate/templates/templates/nodegit.js index c5b8d1da4..c67fae9b6 100644 --- a/generate/templates/templates/nodegit.js +++ b/generate/templates/templates/nodegit.js @@ -5,11 +5,15 @@ var rawApi; // Attempt to load the production release first, if it fails fall back to the // debug release. try { - rawApi = require("../build/Release/nodegit"); + rawApi = require("../build/Release/nodegit.node"); } -catch (e) { +catch (ex) { /* istanbul ignore next */ - rawApi = require("../build/Debug/nodegit"); + if (ex.code !== "MODULE_NOT_FOUND") { + throw ex; + } + + rawApi = require("../build/Debug/nodegit.node"); } // Native methods do not return an identifiable function, so we @@ -67,6 +71,7 @@ require("./utils/lookup_wrapper"); require("./utils/normalize_options"); // Load up extra types; +require("./convenient_line"); require("./convenient_hunk"); require("./convenient_patch"); require("./status_file"); diff --git a/guides/cloning/README.md b/guides/cloning/README.md index e0c94f899..f5bf53333 100644 --- a/guides/cloning/README.md +++ b/guides/cloning/README.md @@ -5,10 +5,10 @@ title: HTTP/HTTPS Guide description: How to clone with HTTP/HTTPS --- -**In order to run examples, you will need to [Install NodeGit](../../install/basics) +**In order to run examples, you will need to [Install NodeGit](../install) first.** -[Return to cloning guides](../) +[Return to all guides](../) * * * diff --git a/guides/cloning/gh-two-factor/README.md b/guides/cloning/gh-two-factor/README.md index d07b0efd3..11f6520fc 100644 --- a/guides/cloning/gh-two-factor/README.md +++ b/guides/cloning/gh-two-factor/README.md @@ -5,10 +5,10 @@ title: GitHub Two Factor Auth Guide description: How to clone with GitHub Two Factor Authorization --- -**In order to run examples, you will need to [Install NodeGit](../../install/basics) +**In order to run examples, you will need to [Install NodeGit](../../install) first.** -[Return to cloning guides](../) +[Return to all guides](../../) * * * diff --git a/guides/cloning/ssh-with-agent/README.md b/guides/cloning/ssh-with-agent/README.md index 013f646a8..9cc111069 100644 --- a/guides/cloning/ssh-with-agent/README.md +++ b/guides/cloning/ssh-with-agent/README.md @@ -5,10 +5,10 @@ title: SSH w/ Agent Guide description: How to clone with SSH using an agent --- -**In order to run examples, you will need to [Install NodeGit](../../install/basics) +**In order to run examples, you will need to [Install NodeGit](../../install) first.** -[Return to cloning guides](../) +[Return to all guides](../../) * * * diff --git a/guides/install/README.md b/guides/install/README.md index f507070ff..1cb727a1d 100644 --- a/guides/install/README.md +++ b/guides/install/README.md @@ -5,7 +5,7 @@ title: Install Basics description: How to install NodeGit --- -[Return to install guides](../) +[Return to all guides](../) * * * diff --git a/guides/install/atom-shell/README.md b/guides/install/atom-shell/README.md index f4078791a..cdf38772e 100644 --- a/guides/install/atom-shell/README.md +++ b/guides/install/atom-shell/README.md @@ -5,7 +5,7 @@ title: Atom Shell description: How to install NodeGit with Atom Shell --- -[Return to install guides](../) +[Return to all guides](../../) * * * diff --git a/guides/install/from-source/README.md b/guides/install/from-source/README.md index b0679fc1b..c85e2e3fa 100644 --- a/guides/install/from-source/README.md +++ b/guides/install/from-source/README.md @@ -5,7 +5,7 @@ title: From source description: How to build NodeGit from source --- -[Return to install guides](../) +[Return to all guides](../../) * * * @@ -54,7 +54,7 @@ Note that GCC/G++ 4.7+ are required, as the library makes use of some c++11 std - [Download and install Python 2](https://www.python.org/download/windows). - [Download and install VS Community](https://www.visualstudio.com/products/visual-studio-community-vs). -You may have to add a build flag to the installation process to successfully install. +You may have to add a build flag to the installation process to successfully install. Try first without, if the build fails, try again with the flag. *Allegedly the order in which you install Visual Studio could trigger this error.* diff --git a/guides/install/nw.js/README.md b/guides/install/nw.js/README.md index 49809fad2..5eb978b3a 100644 --- a/guides/install/nw.js/README.md +++ b/guides/install/nw.js/README.md @@ -5,7 +5,7 @@ title: NW.js description: How to install NodeGit with NW.js --- -[Return to install guides](../) +[Return to all guides](../../) * * * diff --git a/guides/repositories/README.md b/guides/repositories/README.md index 429a2ff5d..65cb063c2 100644 --- a/guides/repositories/README.md +++ b/guides/repositories/README.md @@ -5,7 +5,7 @@ title: Opening a Repository description: How to open and free a repository --- -**In order to run examples, you will need to [Install NodeGit](../../install/basics) +**In order to run examples, you will need to [Install NodeGit](../install) first.** [Return to all guides](../) diff --git a/guides/repositories/initializing/README.md b/guides/repositories/initializing/README.md index 8b8ad0f71..90e5090d4 100644 --- a/guides/repositories/initializing/README.md +++ b/guides/repositories/initializing/README.md @@ -5,10 +5,10 @@ title: Initializing description: How to initialize a repository --- -**In order to run examples, you will need to [Install NodeGit](../../install/basics) +**In order to run examples, you will need to [Install NodeGit](../../install) first.** -[Return to repository guides](../) +[Return to all guides](../../) * * * diff --git a/lib/clone.js b/lib/clone.js index b1388b589..8efdae739 100644 --- a/lib/clone.js +++ b/lib/clone.js @@ -1,4 +1,5 @@ var NodeGit = require("../"); +var shallowClone = require("./utils/shallow_clone"); var normalizeOptions = NodeGit.Utils.normalizeOptions; var Clone = NodeGit.Clone; @@ -17,6 +18,7 @@ Clone.clone = function(url, local_path, options) { var remoteCallbacks; if (options) { + options = shallowClone(options); remoteCallbacks = options.remoteCallbacks; delete options.remoteCallbacks; } diff --git a/lib/convenient_hunk.js b/lib/convenient_hunk.js index 9c28dd296..ca3d8f0e6 100644 --- a/lib/convenient_hunk.js +++ b/lib/convenient_hunk.js @@ -1,4 +1,5 @@ var NodeGit = require("../"); +var ConvenientLine = NodeGit.ConvenientLine; function ConvenientHunk(raw, i) { this.raw = raw; @@ -29,7 +30,7 @@ ConvenientHunk.prototype.size = function() { ConvenientHunk.prototype.lines = function() { var result = []; for (var i = 0; i < this.size(); i++) { - result.push(this.raw.getLineInHunk(this.i, i)); + result.push(new ConvenientLine(this.raw.getLineInHunk(this.i, i), i)); } return result; }; diff --git a/lib/convenient_line.js b/lib/convenient_line.js new file mode 100644 index 000000000..2d39f6501 --- /dev/null +++ b/lib/convenient_line.js @@ -0,0 +1,73 @@ +var NodeGit = require("../"); + +function ConvenientLine(raw, i) { + this.raw = raw; + this.i = i; +} + +/** +* The content of the line +* @return {String} +*/ +ConvenientLine.prototype.origin = function() { + return this.raw.origin(); +}; + +/** +* The content of the line +* @return {String} +*/ +ConvenientLine.prototype.oldLineno = function() { + return this.raw.oldLineno(); +}; + +/** +* The content of the line +* @return {String} +*/ +ConvenientLine.prototype.newLineno = function() { + return this.raw.newLineno(); +}; + +/** +* The content of the line +* @return {String} +*/ +ConvenientLine.prototype.numLines = function() { + return this.raw.numLines(); +}; + +/** +* The content of the line +* @return {String} +*/ +ConvenientLine.prototype.contentLen = function() { + return this.raw.contentLen(); +}; + + +/** +* The content of the line +* @return {String} +*/ +ConvenientLine.prototype.contentOffset = function() { + return this.raw.contentOffset(); +}; + +/** +* The content of the line +* @return {String} +*/ +ConvenientLine.prototype.rawContent = function() { + return this.raw.content(); +}; + +/** +* The relevant line +* @return {String} +*/ +ConvenientLine.prototype.content = function() { + return this.raw.content().substring(0, this.raw.contentLen() - 1); +}; + +NodeGit.ConvenientLine = ConvenientLine; diff --git a/lib/diff.js b/lib/diff.js index 4761dfdfd..91f72d168 100644 --- a/lib/diff.js +++ b/lib/diff.js @@ -62,3 +62,31 @@ Diff.prototype.findSimilar = function(opts) { opts = normalizeOptions(opts, NodeGit.DiffFindOptions); return findSimilar.call(this, opts); }; + +var blobToBuffer = Diff.blobToBuffer; +Diff.blobToBuffer= function( + old_blob, + old_as_path, + buffer, + buffer_as_path, + opts, + file_cb, + hunk_cb, + line_cb) { + var bufferLength = !buffer ? 0 : buffer.length; + + opts = normalizeOptions(opts, NodeGit.DiffOptions); + + return blobToBuffer.call( + this, + old_blob, + old_as_path, + buffer, + bufferLength, + buffer_as_path, + opts, + file_cb, + hunk_cb, + line_cb, + null); +}; diff --git a/lib/index.js b/lib/index.js index 75e6f7e6b..a7f41571e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -31,17 +31,15 @@ Index.prototype.addAll = function(pathspec, flags, matchedCallback) { paths.push(path); }; var idx = this; - return Pathspec.create(pathspec || "*") - .then(function(ps) { - pathspec = ps; - return Status.foreach(repo, statusCB); - }) + var ps = Pathspec.create(pathspec || "*"); + + return Status.foreach(repo, statusCB) .then(function() { return paths; }) .then(function(paths) { paths = paths.filter(function(path) { - return !!(pathspec.matchesPath(0, path)); + return !!(ps.matchesPath(0, path)); }); return addAll.call(idx, paths, flags, matchedCallback, null); }); diff --git a/lib/note.js b/lib/note.js new file mode 100644 index 000000000..4f3ff76bb --- /dev/null +++ b/lib/note.js @@ -0,0 +1,16 @@ +var NodeGit = require("../"); + +var Note = NodeGit.Note; + +// Override Note.foreach to eliminate the need to pass null payload +var foreach = Note.foreach; +Note.foreach = function(repo, notesRef, callback) { + function wrapperCallback(blobId, objectId) { + // We need to copy the OID since libgit2 types are getting cleaned up + // incorrectly right now in callbacks + + return callback(blobId.copy(), objectId.copy()); + } + + return foreach(repo, notesRef, wrapperCallback, null); +}; diff --git a/lib/oid.js b/lib/oid.js index 42d4405af..c3a84ecfb 100644 --- a/lib/oid.js +++ b/lib/oid.js @@ -14,6 +14,10 @@ Object.defineProperties(Oid.prototype, { } }); +Oid.prototype.copy = function() { + return this.cpy(); // seriously??? +}; + Oid.prototype.inspect = function() { return "[Oid " + this.allocfmt() + "]"; }; diff --git a/lib/repository.js b/lib/repository.js index 37e9833ff..2c9058269 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -665,17 +665,18 @@ Repository.prototype.mergeBranches = function(to, from, signature) { signature = signature || repo.defaultSignature(); return Promise.all([ - repo.getBranch(to), - repo.getBranch(from) - ]).then(function(branches) { - toBranch = branches[0]; - fromBranch = branches[1]; + repo.getBranch(to), + repo.getBranch(from) + ]).then(function(objects) { + toBranch = objects[0]; + fromBranch = objects[1]; return Promise.all([ repo.getBranchCommit(toBranch), repo.getBranchCommit(fromBranch) ]); - }).then(function(branchCommits) { + }) + .then(function(branchCommits) { var toCommitOid = branchCommits[0].toString(); var fromCommitOid = branchCommits[1].toString(); @@ -694,12 +695,24 @@ Repository.prototype.mergeBranches = function(to, from, signature) { " to branch " + fromBranch.shorthand(); - return toBranch.setTarget( - fromCommitOid, - signature, - message) + return branchCommits[1].getTree() + .then(function(tree) { + if (toBranch.isHead()) { + // Checkout the tree if we're on the branch + var opts = { + checkoutStrategy: NodeGit.Checkout.STRATEGY.SAFE_CREATE + }; + return NodeGit.Checkout.tree(repo, tree, opts); + } + }) .then(function() { - return fromCommitOid; + return toBranch.setTarget( + fromCommitOid, + signature, + message) + .then(function() { + return fromCommitOid; + }); }); } else { @@ -785,14 +798,14 @@ Repository.prototype.getStatusExt = function(opts) { }; } - return StatusList.create(this, opts).then(function(list) { - for (var i = 0; i < list.entrycount(); i++) { - var entry = Status.byIndex(list, i); - statuses.push(new StatusFile({entry: entry})); - } + var list = StatusList.create(this, opts); - return statuses; - }); + for (var i = 0; i < list.entrycount(); i++) { + var entry = Status.byIndex(list, i); + statuses.push(new StatusFile({entry: entry})); + } + + return statuses; }; /** @@ -804,25 +817,40 @@ Repository.prototype.getStatusExt = function(opts) { */ Repository.prototype.checkoutBranch = function(branch, opts) { var repo = this; - + var reference; opts = opts || {}; - opts.checkoutStrategy = opts.checkoutStrategy || Checkout.STRATEGY.SAFE; - + opts.checkoutStrategy = opts.checkoutStrategy || + Checkout.STRATEGY.SAFE_CREATE; return repo.getReference(branch) .then(function(ref) { if (!ref.isBranch()) { return false; } - - var name = ref.name(); - + reference = ref; + return repo.getBranchCommit(ref.name()); + }) + .then(function(commit) { + return commit.getTree(); + }) + .then(function(tree) { + return Checkout.tree(repo, tree, opts); + }) + .then(function() { + var name = reference.name(); return repo.setHead(name, repo.defaultSignature(), "Switch HEAD to " + name); - }) - .then(function() { - return Checkout.head(repo, opts); }); }; +var fetchheadForeach = Repository.prototype.fetchheadForeach; +/** + * @async + * @param {FetchheadForeachCb} callback The callback function to be called on + * each entry + */ +Repository.prototype.fetchheadForeach = function(callback) { + return fetchheadForeach.call(this, callback, null); +}; + module.exports = Repository; diff --git a/lib/stash.js b/lib/stash.js new file mode 100644 index 000000000..960d7b648 --- /dev/null +++ b/lib/stash.js @@ -0,0 +1,16 @@ +var NodeGit = require("../"); + +var Stash = NodeGit.Stash; + +// Override Stash.foreach to eliminate the need to pass null payload +var foreach = Stash.foreach; +Stash.foreach = function(repo, callback) { + function wrappedCallback(index, message, oid) { + // We need to copy the OID since libgit2 types are getting cleaned up + // incorrectly right now in callbacks + + return callback(index, message, oid.copy()); + } + + return foreach(repo, wrappedCallback, null); +}; diff --git a/lib/status_file.js b/lib/status_file.js index 1b82aa1cb..ddce025b2 100644 --- a/lib/status_file.js +++ b/lib/status_file.js @@ -82,6 +82,20 @@ var StatusFile = function(args) { }, isIgnored: function() { return data.statusBit & codes.IGNORED; + }, + inWorkingTree: function() { + return status & codes.WT_NEW || + status & codes.WT_MODIFIED || + status & codes.WT_DELETED || + status & codes.WT_TYPECHANGE || + status & codes.WT_RENAMED; + }, + inIndex: function() { + return status & codes.INDEX_NEW || + status & codes.INDEX_MODIFIED || + status & codes.INDEX_DELETED || + status & codes.INDEX_TYPECHANGE || + status & codes.INDEX_RENAMED; } }; }; diff --git a/lib/utils/shallow_clone.js b/lib/utils/shallow_clone.js new file mode 100644 index 000000000..f93e67523 --- /dev/null +++ b/lib/utils/shallow_clone.js @@ -0,0 +1,10 @@ +module.exports = function(obj) { + var merges = Array.prototype.slice.call(arguments, 1); + + return merges.reduce(function(obj, merge) { + return Object.keys(merge).reduce(function(obj, key) { + obj[key] = merge[key]; + return obj; + }, obj); + }, obj || {}); +}; diff --git a/lifecycleScripts/checkPrepared.js b/lifecycleScripts/checkPrepared.js index ffb1a5c28..ec3d3da43 100644 --- a/lifecycleScripts/checkPrepared.js +++ b/lifecycleScripts/checkPrepared.js @@ -36,8 +36,8 @@ function checkVendor(name, skipVersion) { var version = ""; if (!skipVersion) { var vendorPackage = pkg[name]; - if (NODE_VERSION === 0.1 && vendorPackage["0.10"]) { - vendorPackage = vendorPackage["0.10"]; + if (vendorPackage[NODE_VERSION]) { + vendorPackage = vendorPackage[NODE_VERSION]; } version = vendorPackage.sha || vendorPackage.version; } diff --git a/lifecycleScripts/install.js b/lifecycleScripts/install.js index 9a39e02a2..65b80319b 100644 --- a/lifecycleScripts/install.js +++ b/lifecycleScripts/install.js @@ -86,7 +86,8 @@ function build() { var opts = { cwd: ".", - maxBuffer: Number.MAX_VALUE + maxBuffer: Number.MAX_VALUE, + env: process.env }; var prefix = ""; diff --git a/lifecycleScripts/retrieveExternalDependencies.js b/lifecycleScripts/retrieveExternalDependencies.js index 8e0d7edce..58f91965a 100644 --- a/lifecycleScripts/retrieveExternalDependencies.js +++ b/lifecycleScripts/retrieveExternalDependencies.js @@ -29,8 +29,8 @@ module.exports = function retrieveExternalDependencies() { function getVendorLib(name) { var vendorPath = "vendor/" + name + "/"; var vendorPackage = pkg[name]; - if (NODE_VERSION === 0.1 && vendorPackage["0.10"]) { - vendorPackage = vendorPackage["0.10"]; + if (vendorPackage[NODE_VERSION]) { + vendorPackage = vendorPackage[NODE_VERSION]; } var version = vendorPackage.sha || vendorPackage.version; diff --git a/package.json b/package.json index 534cd06fc..f512b0d29 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,20 @@ { "name": "nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.3.3", + "version": "0.4.0", "libgit2": { - "url": "https://github.com/nodegit/libgit2/tarball/4b3a1899ff37dddba0a095487505fed9ede101b1", - "sha": "4b3a1899ff37dddba0a095487505fed9ede101b1", - "version": "0.22.1" + "url": "https://github.com/libgit2/libgit2/tarball/fb6df50b7f250a4fd8b2fab257f119a5185e9bf5", + "sha": "fb6df50b7f250a4fd8b2fab257f119a5185e9bf5", + "version": "0.22.2" }, "libssh2": { - "url": "http://www.libssh2.org/download/libssh2-1.4.3.tar.gz", - "version": "1.4.3" + "url": "http://www.libssh2.org/download/libssh2-1.5.0.tar.gz", + "version": "1.5.0" }, "http_parser": { - "url": "https://github.com/joyent/http-parser/archive/v2.3.tar.gz", - "version": "2.3.0", - "0.10": { + "url": "https://github.com/joyent/http-parser/archive/v2.4.2.tar.gz", + "version": "2.4.2", + "0.1": { "url": "https://github.com/joyent/http-parser/archive/v2.0.tar.gz", "version": "2.0.0" } @@ -54,25 +54,27 @@ "node-pre-gyp" ], "dependencies": { - "fs-extra": "^0.16.3", - "node-pre-gyp": "^0.6.2", - "nodegit-promise": "~1.0.0", - "npm": "^2.5.0", + "fs-extra": "^0.18.2", + "node-pre-gyp": "^0.6.5", + "nodegit-promise": "^2.0.1", + "npm": "^2.9.0", "promisify-node": "^0.1.5", - "which-native-nodish": "^1.0.3" + "which-native-nodish": "^1.1.1" }, "devDependencies": { - "combyne": "^0.6.5", - "istanbul": "^0.3.5", - "js-beautify": "^1.5.4", - "jshint": "^2.6.0", - "lodash": "^3.1.0", - "mocha": "~2.1.0", - "nan": "^1.7.0", + "combyne": "^0.8.0", + "coveralls": "^2.11.2", + "istanbul": "^0.3.13", + "js-beautify": "^1.5.5", + "jshint": "^2.7.0", + "lcov-result-merger": "^1.0.2", + "lodash": "^3.8.0", + "mocha": "^2.2.4", + "nan": "~1.7.0", "nw-gyp": "^0.12.4", "pangyp": "^2.1.0", - "request": "^2.53.0", - "tar": "^1.0.3" + "request": "^2.55.0", + "tar": "^2.1.0" }, "binary": { "module_name": "nodegit", @@ -81,10 +83,14 @@ }, "scripts": { "lint": "jshint lib test/tests examples lifecycleScripts", - "cov": "node --expose-gc test", + "coveralls": "cat ./test/coverage/merged.lcov | coveralls", + "filtercov": "lcov --extract test/coverage/cpp/lcov_full.info $(pwd)/src/* $(pwd)/src/**/* $(pwd)/include/* $(pwd)/include/**/* --output-file test/coverage/cpp/lcov.info && rm test/coverage/cpp/lcov_full.info", + "cppcov": "mkdir -p test/coverage/cpp && lcov --gcov-tool $(which gcov) --capture --directory build/Release/obj.target/nodegit/src --output-file test/coverage/cpp/lcov_full.info", + "mergecov": "lcov-result-merger 'test/**/*.info' 'test/coverage/merged.lcov' && genhtml test/coverage/merged.lcov --output-directory test/coverage/report", + "cov": "npm run cppcov && npm run filtercov && npm run mergecov", "mocha": "mocha test/runner test/tests", "mochaDebug": "mocha --debug-brk test/runner test/tests", - "test": "npm run lint && npm run cov", + "test": "npm run lint && (iojs --expose-gc test || node --expose-gc test)", "generateJson": "node generate/scripts/generateJson", "generateNativeCode": "node generate/scripts/generateNativeCode", "generateMissingTests": "node generate/scripts/generateMissingTests", diff --git a/test/index.js b/test/index.js index 7e39d5a26..c78082e31 100644 --- a/test/index.js +++ b/test/index.js @@ -1,20 +1,18 @@ var fork = require("child_process").fork; var path = require("path"); -var args = [ - "cover", - process.platform != "win32" ? - "_mocha" : - "../node_modules/mocha/bin/_mocha", - "--", - "runner", - "tests", - "--report=lcov", +var bin = "./node_modules/.bin/istanbul"; +var cov = "cover --report=lcov --dir=test/coverage/js _mocha --".split(" "); + +if (process.platform === 'win32') { + bin = "./node_modules/mocha/bin/mocha"; + cov = []; +} + +var args = cov.concat([ + "test/runner", + "test/tests", "--expose-gc" -]; +]); -fork("../node_modules/istanbul/lib/cli.js", args, { - cwd: __dirname -}).on("close", function(code) { - process.exit(code); -}); +fork(bin, args, { cwd: path.join(__dirname, "../") }); diff --git a/test/runner.js b/test/runner.js index d3fe8ced3..8a4ff378f 100644 --- a/test/runner.js +++ b/test/runner.js @@ -55,7 +55,9 @@ beforeEach(function() { afterEach(function(done) { process.nextTick(function() { - global.gc(); + if (global.gc) { + global.gc(); + } done(); }); }); diff --git a/test/tests/checkout.js b/test/tests/checkout.js index fbe565125..05c3105a9 100644 --- a/test/tests/checkout.js +++ b/test/tests/checkout.js @@ -86,18 +86,20 @@ describe("Checkout", function() { it("can checkout a branch", function() { var test = this; - return test.repository.checkoutBranch(checkoutBranchName, { - checkoutStrategy: Checkout.STRATEGY.FORCE - }) + return test.repository.checkoutBranch(checkoutBranchName) .then(function() { var packageContent = fse.readFileSync(packageJsonPath, "utf-8"); assert.ok(!~packageContent.indexOf("\"ejs\": \"~1.0.0\",")); }) .then(function() { - return test.repository.checkoutBranch("master", { - checkoutStrategy: Checkout.STRATEGY.FORCE - }); + return test.repository.getStatus(); + }) + .then(function(statuses) { + assert.equal(statuses.length, 0); + }) + .then(function() { + return test.repository.checkoutBranch("master"); }) .then(function() { var packageContent = fse.readFileSync(packageJsonPath, "utf-8"); diff --git a/test/tests/config.js b/test/tests/config.js new file mode 100644 index 000000000..3afeb6d8e --- /dev/null +++ b/test/tests/config.js @@ -0,0 +1,75 @@ +var assert = require("assert"); +var path = require("path"); +var local = path.join.bind(path, __dirname); +var promisify = require("promisify-node"); + +// Have to wrap exec, since it has a weird callback signature. +var exec = promisify(function(command, opts, callback) { + return require("child_process").exec(command, opts, callback); +}); + +describe("Config", function() { + var NodeGit = require("../../"); + + var reposPath = local("../repos/workdir"); + + it("can get and set a global value", function() { + var savedUserName; + + function finallyFn() { + return exec("git config --global user.name \"" + savedUserName + "\""); + } + + return exec("git config --global user.name") + .then(function(userName) { + savedUserName = userName.trim(); + + return exec( + "git config --global user.name \"" + savedUserName + "-test\""); + }) + .then(function() { + return NodeGit.Config.openDefault(); + }) + .then(function(config) { + return config.getString("user.name"); + }) + .then(function(userNameFromNodeGit) { + assert.equal(savedUserName + "-test", userNameFromNodeGit); + }) + .then(finallyFn, finallyFn); + }); + + it("can get and set a repo config value", function() { + var savedUserName; + + function finallyFn() { + return exec("git config user.name \"" + savedUserName + "\"", { + cwd: reposPath + }); + } + + return exec("git config user.name", { + cwd: reposPath + }) + .then(function(userName) { + savedUserName = userName.trim(); + + return exec("git config user.name \"" + savedUserName + "-test\"", { + cwd: reposPath + }); + }) + .then(function() { + return NodeGit.Repository.open(reposPath); + }) + .then(function(repo) { + return repo.config(); + }) + .then(function(config) { + return config.getString("user.name"); + }) + .then(function(userNameFromNodeGit) { + assert.equal(savedUserName + "-test", userNameFromNodeGit); + }) + .then(finallyFn, finallyFn); + }); +}); diff --git a/test/tests/diff.js b/test/tests/diff.js index 96c720a0e..66ab6b1c9 100644 --- a/test/tests/diff.js +++ b/test/tests/diff.js @@ -108,14 +108,14 @@ describe("Diff", function() { var oldContent = "__Before submitting a pull request, please ensure " + "both unit tests and lint checks pass.__\n"; - assert.equal(lines[3].content(), oldContent); + assert.equal(lines[3].rawContent(), oldContent); assert.equal(lines[3].origin(), Diff.LINE.DELETION); assert.equal(lines[3].contentLen(), 90); var newContent = "__Before submitting a pull request, please ensure " + "both that you've added unit tests to cover your shiny new code, " + "and that all unit tests and lint checks pass.__\n"; - assert.equal(lines[4].content(), newContent); + assert.equal(lines[4].rawContent(), newContent); assert.equal(lines[4].origin(), Diff.LINE.ADDITION); assert.equal(lines[4].contentLen(), 162); }); @@ -134,6 +134,49 @@ describe("Diff", function() { assert.equal(newFile.size(), 23); }); + it("can resolve individual line chages from the patch hunks", function() { + this.workdirDiff.patches().forEach(function(convenientPatch) { + convenientPatch.hunks().forEach(function(convenientHunk) { + convenientHunk.lines().forEach(function(line) { + assert(!/\n/.exec(line.content())); + assert(/\n/.exec(line.rawContent())); + }); + }); + }); + }); + + it("can diff the contents of a file to a string", function(done) { + this.repository.getBranchCommit("master") + .then(function(commit) { + return commit.getEntry("LICENSE"); + }) + .then(function(entry) { + var _entry = entry; + return _entry.getBlob(); + }) + .then(function(blob) { + var buffer = "New Text"; + return Diff.blobToBuffer( + blob, + null, + buffer, + null, + null, + null, + function(delta, hunk, payload) { + assert.equal(hunk.oldStart(), 1); + assert.equal(hunk.oldLines(), 19); + assert.equal(hunk.newStart(), 1); + assert.equal(hunk.newLines(), 1); + assert.equal( + hunk.header().substring(0, hunk.headerLen() - 1), + "@@ -1,19 +1 @@" + ); + done(); + }); + }); + }); + it("can diff with a null tree", function() { var repo = this.repository; var tree = this.masterCommitTree; diff --git a/test/tests/graph.js b/test/tests/graph.js new file mode 100644 index 000000000..10f4db12b --- /dev/null +++ b/test/tests/graph.js @@ -0,0 +1,31 @@ +var assert = require("assert"); +var path = require("path"); +var local = path.join.bind(path, __dirname); + +describe("Graph", function() { + var NodeGit = require("../../"); + var Repository = NodeGit.Repository; + var Graph = NodeGit.Graph; + + var reposPath = local("../repos/workdir"); + + beforeEach(function() { + var test = this; + + return Repository.open(reposPath) + .then(function(repository) { + test.repository = repository; + }); + }); + + it("can get commits ahead/behind for 2 different commits", function() { + return Graph.aheadBehind( + this.repository, + "32789a79e71fbc9e04d3eff7425e1771eb595150", + "1729c73906bb8467f4095c2f4044083016b4dfde") + .then(function(result) { + assert.equal(result.ahead, 1); + assert.equal(result.behind, 1); + }); + }); +}); diff --git a/test/tests/index.js b/test/tests/index.js index 846fa1e72..f073977eb 100644 --- a/test/tests/index.js +++ b/test/tests/index.js @@ -12,7 +12,7 @@ var writeFile = promisify(function(filename, data, callback) { describe("Index", function() { var NodeGit = require("../../"); var Repository = NodeGit.Repository; - + var reposPath = local("../repos/workdir"); beforeEach(function() { diff --git a/test/tests/merge.js b/test/tests/merge.js index 14f4b4a2f..b08de4bc3 100644 --- a/test/tests/merge.js +++ b/test/tests/merge.js @@ -214,6 +214,10 @@ describe("Merge", function() { theirCommit = commit; }); }) + .then(function() { + var opts = {checkoutStrategy: NodeGit.Checkout.STRATEGY.FORCE}; + return repository.checkoutBranch(ourBranchName, opts); + }) .then(function() { return repository.mergeBranches( ourBranchName, @@ -228,6 +232,13 @@ describe("Merge", function() { .then(function(branchCommit) { assert.equal(oid.toString(), branchCommit.toString()); }); + }) + .then(function() { + return repository.getStatus(); + }) + .then(function(statuses) { + // make sure we didn't change the index + assert.equal(statuses.length, 0); }); }); diff --git a/test/tests/note.js b/test/tests/note.js new file mode 100644 index 000000000..1624714e7 --- /dev/null +++ b/test/tests/note.js @@ -0,0 +1,69 @@ +var assert = require("assert"); +var path = require("path"); +var local = path.join.bind(path, __dirname); + +describe("Note", function() { + var NodeGit = require("../../"); + var Note = NodeGit.Note; + var Signature = NodeGit.Signature; + var reposPath = local("../../"); + + beforeEach(function() { + var test = this; + + return NodeGit.Repository.open(reposPath).then(function(repository) { + test.repository = repository; + + return repository.getMasterCommit().then(function(commit) { + test.commit = commit; + }); + }); + }); + + it("can be created", function() { + var sha = this.commit.id(); + var sig = Signature.create("John", "john@doe.com", Date.now(), 0); + var noteRef = "refs/notes/commits"; + + return Note.create(this.repository, noteRef, sig, sig, sha, "Testing!", 1); + }); + + it("can be read", function() { + var sha = this.commit.id(); + var noteRef = "refs/notes/commits"; + + return Note.read(this.repository, noteRef, sha).then(function(note) { + assert.equal(note.message(), "Testing!"); + }); + }); + + it("can iterate all notes", function() { + var test = this; + var noteRef = "refs/notes/commits"; + var ref = null; + + return Note.foreach(this.repository, noteRef, function(blobId, objectId) { + ref = objectId; + }).then(function() { + return NodeGit.Note.read(test.repository, noteRef, ref) + .then(function(note) { + assert.equal(note.message(), "Testing!"); + }); + }); + }); + + it("can be removed", function(done) { + var test = this; + var sha = this.commit.id(); + var noteRef = "refs/notes/commits"; + var sig = Signature.create("John", "john@doe.com", Date.now(), 0); + + return Note.remove(this.repository, noteRef, sig, sig, sha) + .then(function() { + return Note.read(test.repository, noteRef, sha).catch(function(ex) { + assert.equal(ex.message, "Note could not be found"); + done(); + }); + }); + }); +}); diff --git a/test/tests/oid.js b/test/tests/oid.js index 8efcb12b4..7ec57631d 100644 --- a/test/tests/oid.js +++ b/test/tests/oid.js @@ -1,4 +1,6 @@ var assert = require("assert"); +var path = require("path"); +var local = path.join.bind(path, __dirname); describe("Oid", function() { var NodeGit = require("../../"); @@ -26,4 +28,19 @@ describe("Oid", function() { assert.equal(inspect, "[Oid " + oid + "]"); }); + + it("can convert strings to oids in parameters", function() { + return NodeGit.Repository.open(local("../repos/workdir")) + .then(function(repo) { + var revwalk = repo.createRevWalk(); + revwalk.sorting(NodeGit.Revwalk.SORT.TIME); + + revwalk.push(oid); + + return revwalk.getCommits(1); + }) + .then(function(commits) { + assert.equal(commits[0].toString(), oid); + }); + }); }); diff --git a/test/tests/packbuilder.js b/test/tests/packbuilder.js new file mode 100644 index 000000000..cfd193238 --- /dev/null +++ b/test/tests/packbuilder.js @@ -0,0 +1,25 @@ +var assert = require("assert"); +var path = require("path"); +var local = path.join.bind(path, __dirname); + +describe("Packbuilder", function() { + var NodeGit = require("../../"); + var Repository = NodeGit.Repository; + var Packbuilder = NodeGit.Packbuilder; + + var reposPath = local("../repos/workdir"); + + beforeEach(function() { + var test = this; + + return Repository.open(reposPath).then(function(repository) { + test.repository = repository; + }); + }); + + it("can be initialized", function() { + var packBuilder = Packbuilder.create(this.repository); + + assert(packBuilder instanceof Packbuilder); + }); +}); diff --git a/test/tests/pathspec.js b/test/tests/pathspec.js index 23a19cb74..28741b068 100644 --- a/test/tests/pathspec.js +++ b/test/tests/pathspec.js @@ -5,46 +5,40 @@ describe("Pathspec", function() { var Pathspec = NodeGit.Pathspec; it("can accept just about anything against a * pathspec", function() { - return Pathspec.create("*") - .then(function(pathspec) { - assert.equal(pathspec.matchesPath(0, "burritoooo"), 1); - assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 1); - }); + var pathspec = Pathspec.create("*"); + + assert.equal(pathspec.matchesPath(0, "burritoooo"), 1); + assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 1); }); it("can take a * in an array", function() { - return Pathspec.create(["*"]) - .then(function(pathspec) { - assert.equal(pathspec.matchesPath(0, "burritoooo"), 1); - assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 1); - }); + var pathspec = Pathspec.create("*"); + + assert.equal(pathspec.matchesPath(0, "burritoooo"), 1); + assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 1); }); it("can take a single file", function() { - return Pathspec.create(["myDir/burritoSupreme.mp4"]) - .then(function(pathspec) { - assert.equal(pathspec.matchesPath(0, "myDir/burritoSupreme.mp4"), 1); - assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 0); - }); + var pathspec = Pathspec.create(["myDir/burritoSupreme.mp4"]); + + assert.equal(pathspec.matchesPath(0, "myDir/burritoSupreme.mp4"), 1); + assert.equal(pathspec.matchesPath(0, "bob/ted/yoghurt.mp3"), 0); }); it("can take files in an array", function() { - return Pathspec.create(["gwendoline.txt", "sausolito.ogg"]) - .then(function(pathspec) { - assert.equal(pathspec.matchesPath(0, "gwendoline.txt"), 1); - assert.equal(pathspec.matchesPath(0, "sausolito.ogg"), 1); - assert.equal(pathspec.matchesPath(0, "sausolito.txt"), 0); - }); + var pathspec = Pathspec.create(["gwendoline.txt", "sausolito.ogg"]); + + assert.equal(pathspec.matchesPath(0, "gwendoline.txt"), 1); + assert.equal(pathspec.matchesPath(0, "sausolito.ogg"), 1); + assert.equal(pathspec.matchesPath(0, "sausolito.txt"), 0); }); it("can handle dirs", function() { - return Pathspec.create(["myDir/", "bob.js"]) - .then(function(pathspec) { - assert.equal(pathspec.matchesPath(0, "bob.js"), 1); - assert.equal(pathspec.matchesPath(0, "myDir/bob2.js"), 1); - assert.equal(pathspec.matchesPath(0, "bob2.js"), 0); - assert.equal(pathspec.matchesPath(0, "herDir/bob.js"), 0); - }); - }); + var pathspec = Pathspec.create(["myDir/", "bob.js"]); + assert.equal(pathspec.matchesPath(0, "bob.js"), 1); + assert.equal(pathspec.matchesPath(0, "myDir/bob2.js"), 1); + assert.equal(pathspec.matchesPath(0, "bob2.js"), 0); + assert.equal(pathspec.matchesPath(0, "herDir/bob.js"), 0); + }); }); diff --git a/test/tests/remote.js b/test/tests/remote.js index a1a9e8e9d..d32fda781 100644 --- a/test/tests/remote.js +++ b/test/tests/remote.js @@ -12,11 +12,19 @@ describe("Remote", function() { var url = "https://github.com/nodegit/test"; var url2 = "https://github.com/nodegit/test2"; - function removeOrigins(repository) { - Remote.delete(repository, "origin1"); - Remote.delete(repository, "origin2"); - Remote.delete(repository, "origin3"); - Remote.delete(repository, "test2"); + function removeOrigins(repo) { + return repo.getRemotes() + .then(function(remotes) { + var promises = []; + + remotes.forEach(function(remote) { + if (remote !== "origin") { + promises.push(Remote.delete(repo, remote)); + } + }); + + return Promise.all(promises); + }); } beforeEach(function() { @@ -53,16 +61,10 @@ describe("Remote", function() { it("can set a remote", function() { var repository = this.repository; - var newRemote; + var remote = Remote.create(repository, "origin1", url); - return Remote.create(repository, "origin1", url) - .then(function(remote) { - newRemote = remote; - return remote.setPushurl("https://google.com/"); - }) - .then(function() { - assert(newRemote.pushurl(), "https://google.com/"); - }); + remote.setPushurl("https://google.com/"); + assert(remote.pushurl(), "https://google.com/"); }); it("can read the remote name", function() { @@ -71,22 +73,19 @@ describe("Remote", function() { it("can create and load a new remote", function() { var repository = this.repository; + var remote = Remote.create(repository, "origin2", url); - return Remote.create(repository, "origin2", url) - .then(function() { - return Remote.lookup(repository, "origin2"); - }) - .then(function(remote) { - assert(remote.url(), url); - }); + return Remote.lookup(repository, "origin2").then(function() { + assert(remote.url(), url); + }); }); it("can delete a remote", function() { var repository = this.repository; + Remote.create(repository, "origin3", url); - return Remote.create(repository, "origin3", url) - .then(function(remote) { - Remote.delete(repository, "origin3"); + return Remote.delete(repository, "origin3") + .then(function() { return Remote.lookup(repository, "origin3"); }) .then(Promise.reject, Promise.resolve); @@ -119,31 +118,30 @@ describe("Remote", function() { var repo = this.repository; var wasCalled = false; - return Remote.create(repo, "test2", url2) - .then(function() { - return repo.getRemote("test2"); - }) - .then(function(remote) { - remote.setCallbacks({ - credentials: function(url, userName) { - return NodeGit.Cred.sshKeyFromAgent(userName); - }, - certificateCheck: function() { - return 1; - }, - - transferProgress: function() { - wasCalled = true; - } - }); + Remote.create(repo, "test2", url2); + + return repo.getRemote("test2") + .then(function(remote) { + remote.setCallbacks({ + credentials: function(url, userName) { + return NodeGit.Cred.sshKeyFromAgent(userName); + }, + certificateCheck: function() { + return 1; + }, - return remote.fetch(null, repo.defaultSignature(), null); - }) - .then(function() { - assert.ok(wasCalled); + transferProgress: function() { + wasCalled = true; + } + }); - Remote.delete(repo, "test2"); - }); + return remote.fetch(null, repo.defaultSignature(), null); + }) + .then(function() { + assert.ok(wasCalled); + + return Remote.delete(repo, "test2"); + }); }); it("can fetch from a remote", function() { diff --git a/test/tests/repository.js b/test/tests/repository.js index e82045fd3..4062e1440 100644 --- a/test/tests/repository.js +++ b/test/tests/repository.js @@ -120,12 +120,12 @@ describe("Repository", function() { return fse.writeFile(filePath, fileContent) .then(function() { - return repo.getStatusExt().then(function(statuses) { - assert.equal(statuses.length, 1); - assert.equal(statuses[0].path(), fileName); - assert.equal(statuses[0].indexToWorkdir().newFile().path(), fileName); - assert.ok(statuses[0].isNew()); - }); + var statuses = repo.getStatusExt(); + + assert.equal(statuses.length, 1); + assert.equal(statuses[0].path(), fileName); + assert.equal(statuses[0].indexToWorkdir().newFile().path(), fileName); + assert.ok(statuses[0].isNew()); }) .then(function() { return fse.remove(filePath); @@ -137,4 +137,36 @@ describe("Repository", function() { }); }); }); + + it("gets fetch-heads", function() { + var repo = this.repository; + var foundMaster; + + return repo.fetch("origin", { + credentials: function(url, userName) { + return NodeGit.Cred.sshKeyFromAgent(userName); + }, + certificateCheck: function() { + return 1; + } + }) + .then(function() { + return repo.fetchheadForeach(function(refname, remoteUrl, oid, isMerge) { + if (refname == "refs/heads/master") { + foundMaster = true; + assert.equal(refname, "refs/heads/master"); + assert.equal(remoteUrl, "https://github.com/nodegit/test"); + assert.equal( + oid.toString(), + "32789a79e71fbc9e04d3eff7425e1771eb595150"); + assert.equal(isMerge, 1); + } + }); + }) + .then(function() { + if (!foundMaster) { + throw new Error("Couldn't find master in iteration of fetch heads"); + } + }); + }); }); diff --git a/test/tests/stash.js b/test/tests/stash.js new file mode 100644 index 000000000..0af8e7587 --- /dev/null +++ b/test/tests/stash.js @@ -0,0 +1,87 @@ +var assert = require("assert"); +var path = require("path"); +var promisify = require("promisify-node"); +var Promise = require("nodegit-promise"); +var fse = promisify(require("fs-extra")); +var local = path.join.bind(path, __dirname); + +describe("Stash", function() { + var NodeGit = require("../../"); + var Repository = NodeGit.Repository; + var Stash = NodeGit.Stash; + + var reposPath = local("../repos/workdir"); + + before(function() { + var test = this; + return Repository.open(reposPath) + .then(function(repository) { + test.repository = repository; + }); + }); + + it("gets no stashes on clean working directory", function() { + var stashes = []; + var stashCb = function(index, message, oid) { + stashes.push({index: index, message: message, oid: oid}); + }; + + return Stash.foreach(this.repository, stashCb) + .then(function() { + assert.equal(stashes.length, 0); + }); + }); + + it("can save and drop a stash", function() { + var fileName = "README.md"; + var fileContent = "Cha-cha-cha-chaaaaaangessssss"; + var repo = this.repository; + var filePath = path.join(repo.workdir(), fileName); + var oldContent; + var stashes = []; + var stashOid; + var stashMessage = "stash test"; + + return fse.readFile(filePath) + .then(function(content) { + oldContent = content; + return fse.writeFile(filePath, fileContent); + }) + .then(function() { + return Stash.save(repo, repo.defaultSignature(), stashMessage, 0); + }) + .then(function(oid) { + stashOid = oid; + var stashCb = function(index, message, oid) { + stashes.push({index: index, message: message, oid: oid}); + }; + + return Stash.foreach(repo, stashCb); + }) + .then(function() { + assert.equal(stashes.length, 1); + assert.equal(stashes[0].index, 0); + assert.equal(stashes[0].message, "On master: " + stashMessage); + assert.equal(stashes[0].oid.toString(), stashOid.toString()); + + return Stash.drop(repo, 0); + }) + .then(function () { + stashes = []; + var stashCb = function(index, message, oid) { + stashes.push({index: index, message: message, oid: oid}); + }; + + return Stash.foreach(repo, stashCb); + }) + .then(function() { + assert.equal(stashes.length, 0); + }) + .catch(function(e) { + return fse.writeFile(filePath, oldContent) + .then(function() { + return Promise.reject(e); + }); + }); + }); +}); diff --git a/test/tests/status_file.js b/test/tests/status_file.js index cd669350d..dd709eee8 100644 --- a/test/tests/status_file.js +++ b/test/tests/status_file.js @@ -20,4 +20,9 @@ describe("StatusFile", function() { assert.ok(this.status.isNew()); assert.ok(!this.status.isModified()); }); + + it("detects working tree and index statuses", function() { + assert.ok(this.status.inWorkingTree()); + assert.ok(!this.status.inIndex()); + }); }); diff --git a/vendor/libgit2.gyp b/vendor/libgit2.gyp index 0af36d465..afdfc620e 100644 --- a/vendor/libgit2.gyp +++ b/vendor/libgit2.gyp @@ -463,6 +463,9 @@ "libssh2/win32", "libssh2/include" ], + "defines!": [ + "HAVE_POLL" + ], "direct_dependent_settings": { "include_dirs": [ "libssh2/src",