From ed6d18279e592c62498d9a2ede9dbbe58d354864 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Thu, 8 Nov 2018 12:20:08 +0800 Subject: [PATCH 01/22] config node-gyp-pre url --- package.json | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index f523fdae1..c7ea2e00c 100644 --- a/package.json +++ b/package.json @@ -47,22 +47,23 @@ "promisify-node": "~0.3.0", "ramda": "^0.25.0", "request-promise-native": "^1.0.5", - "tar-fs": "^1.16.3" + "tar-fs": "^1.16.3", + "walk": "^2.3.9", + "babel-cli": "^6.7.7", + "babel-preset-es2015": "^6.6.0", + "combyne": "~0.8.1", + "js-beautify": "~1.5.10" }, "devDependencies": { "aws-sdk": "^2.326.0", - "babel-cli": "^6.7.7", - "babel-preset-es2015": "^6.6.0", "cheerio": "^1.0.0-rc.2", "clean-for-publish": "~1.0.2", "combyne": "~0.8.1", "coveralls": "^3.0.2", "istanbul": "^0.4.5", - "js-beautify": "~1.5.10", "jshint": "^2.9.6", "lcov-result-merger": "^3.1.0", - "mocha": "^5.2.0", - "walk": "^2.3.9" + "mocha": "^5.2.0" }, "vendorDependencies": { "libssh2": "1.8.0", @@ -71,7 +72,8 @@ "binary": { "module_name": "nodegit", "module_path": "./build/Release/", - "host": "https://axonodegit.s3.amazonaws.com/nodegit/nodegit/" + "host": "https://github.com/elastic/nodegit/releases/download/", + "remote_path": "{version}" }, "scripts": { "babel": "babel --presets es2015 -d ./dist ./lib", @@ -88,7 +90,7 @@ "mergecov": "lcov-result-merger 'test/**/*.info' 'test/coverage/merged.lcov' && ./lcov-1.10/bin/genhtml test/coverage/merged.lcov --output-directory test/coverage/report", "mocha": "mocha --expose-gc test/runner test/tests --timeout 15000", "mochaDebug": "mocha --expose-gc --debug-brk test/runner test/tests --timeout 15000", - "postinstall": "node lifecycleScripts/postinstall", + "postinstall": "node lifecycleScripts/postinstall && node generate && npm run babel", "prepublish": "npm run babel", "rebuild": "node generate && npm run babel && node-gyp configure build", "rebuildDebug": "node generate && npm run babel && node-gyp configure --debug build", From 74fc5f393bc6d5538797f9cfb1a22a7cbbad5e14 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Tue, 11 Dec 2018 15:12:39 +0800 Subject: [PATCH 02/22] host binary in s3 --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index c7ea2e00c..66970d2d1 100644 --- a/package.json +++ b/package.json @@ -72,8 +72,7 @@ "binary": { "module_name": "nodegit", "module_path": "./build/Release/", - "host": "https://github.com/elastic/nodegit/releases/download/", - "remote_path": "{version}" + "host": "https://download.elasticsearch.org/code/nodegit/" }, "scripts": { "babel": "babel --presets es2015 -d ./dist ./lib", From 6b8cbe2b81ed5207149828be2d6e652abc557cd1 Mon Sep 17 00:00:00 2001 From: Yulong Date: Sat, 15 Dec 2018 15:51:38 +0800 Subject: [PATCH 03/22] Libcurl (#6) * bump version 0.24.0-alpha.6 * make libcurl and libssl static linked in linux * Reduce the logs to conform with travis ci * Use -fPIC for libssl * make libcurl and libssl static linked in linux --- .travis.yml | 55 +++--- appveyor.yml | 8 +- generate/templates/templates/binding.gyp | 210 +++++++++++++---------- lib/utils/binary_info.js | 17 ++ 4 files changed, 169 insertions(+), 121 deletions(-) create mode 100644 lib/utils/binary_info.js diff --git a/.travis.yml b/.travis.yml index 682ca1cf9..f921535ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ sudo: false -dist: xenial +# update to Xenial in April 2019; Trusty will be EOL, Xenial new minimum supported OS version +dist: trusty branches: only: @@ -22,6 +23,7 @@ env: node_js: - "10" - "8" + - "6" os: - linux @@ -35,14 +37,8 @@ jobs: - stage: "Extended testing" os: linux dist: xenial - node_js: "8" + node_js: "10" env: TARGET_ARCH="x64" EXTENDED_TESTING="false" SKIP_DEPLOY="true" - - stage: "Deploy documentation" - os: linux - dist: xenial - node_js: "8" - env: TARGET_ARCH="x64" DEPLOY_DOCUMENTATION="true" - git: depth: 5 @@ -53,24 +49,44 @@ addons: - ubuntu-toolchain-r-test packages: - build-essential + - clang - libssl-dev - gcc-4.9-multilib - g++-4.9-multilib - lcov + before_install: - - export CC=clang + - export CC="clang -fPIC" - export CXX=clang++ - export npm_config_clang=1 - export JOBS=4 + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then + cd $HOME; + wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz; + tar xfz openssl-1.0.2o.tar.gz; + cd openssl-1.0.2o; + CFLAGS="-fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" ./config; + CFLAGS="-fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" TARGET_ARCH="" make; + sudo make install; + fi + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then + cd $HOME; + wget https://curl.haxx.se/download/curl-7.63.0.tar.gz; + tar xfz curl-7.63.0.tar.gz; + cd curl-7.63.0; + CFLAGS="-fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" LIBS="-ldl -lpthread" ./configure --disable-shared --with-ssl=/usr/local/ssl/; + CFLAGS="-fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" make; + sudo make install; + fi + + - cd $TRAVIS_BUILD_DIR - if [ -z "$TRAVIS_TAG" ] && [ "$EXTENDED_TESTING" == "true" ]; then export GYP_DEFINES="coverage=1 use_obsolete_asm=true"; - export CC=/usr/bin/gcc-4.9; - export CXX=/usr/bin/g++-4.9; export npm_config_clang=0; wget http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz; - tar xvfz lcov-1.10.tar.gz; + tar xfz lcov-1.10.tar.gz; else export GYP_DEFINES="use_obsolete_asm=true"; fi @@ -99,6 +115,7 @@ script: after_success: - if [ -n "$TRAVIS_TAG" ] && [ "$EXTENDED_TESTING" != "true" ] && [ "$DEPLOY_DOCUMENTATION" != "true" ] && [ "$SKIP_DEPLOY" != "true" ]; then + cd $TRAVIS_BUILD_DIR npm install -g node-pre-gyp; npm install -g aws-sdk; node lifecycleScripts/clean; @@ -106,17 +123,3 @@ after_success: node-pre-gyp publish --target_arch=$TARGET_ARCH; fi - - if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ -n "$TRAVIS_TAG" ] && [ "$DEPLOY_DOCUMENTATION" == "true" ]; then - .travis/deploy-docs.sh; - fi - -notifications: - slack: - secure: KglNSqZiid9YudCwkPFDh+sZfW5BwFlM70y67E4peHwwlbbV1sSBPHcs74ZHP/lqgEZ4hMv4N2NI58oYFD5/1a+tKIQP1TkdIMuq4j2LXheuirA2HDcydOVrsC8kRx5XFGKdVRg/uyX2dlRHcOWFhxrS6yc6IxtxYWlRTD2SmEc= - - webhooks: - urls: - - https://webhooks.gitter.im/e/cbafdb27ad32ba746a73 - on_success: always # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: false # default: false diff --git a/appveyor.yml b/appveyor.yml index 46fc6a1b5..47bf80a69 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -27,7 +27,7 @@ environment: matrix: # Node.js - nodejs_version: "10" - - nodejs_version: "8" + matrix: fast_finish: true @@ -54,9 +54,3 @@ on_success: - IF %APPVEYOR_REPO_TAG%==true node-pre-gyp publish build: off - -branches: - only: - - /backport\/.*/ - - master - - v0.3 diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index 3d2d80a0d..48367e20f 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -1,14 +1,41 @@ { - "variables": { - "is_electron%": " Date: Wed, 6 Mar 2019 14:10:38 +0800 Subject: [PATCH 04/22] publish to @elastic/nodegit --- package.json | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 66970d2d1..22109fb56 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "nodegit", + "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", "version": "0.25.0-alpha.9", "homepage": "http://nodegit.org", @@ -10,25 +10,10 @@ "native" ], "license": "MIT", - "author": "Tim Branyen (@tbranyen)", - "contributors": [ - { - "name": "John Haley", - "email": "john@haley.io" - }, - { - "name": "Max Korp", - "email": "maxkorp@8bytealchemy.com" - }, - { - "name": "Tyler Ang-Wanek", - "email": "tylerw@axosoft.com" - } - ], "main": "dist/nodegit.js", "repository": { "type": "git", - "url": "git://github.com/nodegit/nodegit.git" + "url": "git://github.com/elastic/nodegit.git" }, "directories": { "build": "./build", @@ -89,7 +74,7 @@ "mergecov": "lcov-result-merger 'test/**/*.info' 'test/coverage/merged.lcov' && ./lcov-1.10/bin/genhtml test/coverage/merged.lcov --output-directory test/coverage/report", "mocha": "mocha --expose-gc test/runner test/tests --timeout 15000", "mochaDebug": "mocha --expose-gc --debug-brk test/runner test/tests --timeout 15000", - "postinstall": "node lifecycleScripts/postinstall && node generate && npm run babel", + "postinstall": "node lifecycleScripts/postinstall", "prepublish": "npm run babel", "rebuild": "node generate && npm run babel && node-gyp configure build", "rebuildDebug": "node generate && npm run babel && node-gyp configure --debug build", From 4595ef39d3bbe18aeeb16b483555e94ae669b9ec Mon Sep 17 00:00:00 2001 From: spacedragon Date: Thu, 7 Mar 2019 10:20:19 +0800 Subject: [PATCH 05/22] bundle ts type definitions in package --- package.json | 3 +- types/LICENSE | 21 +++ types/README.md | 16 ++ types/annotated-commit.d.ts | 19 +++ types/attr.d.ts | 38 +++++ types/blame-hunk.d.ts | 13 ++ types/blame-options.d.ts | 12 ++ types/blame.d.ts | 44 +++++ types/blob.d.ts | 41 +++++ types/branch.d.ts | 25 +++ types/buf.d.ts | 13 ++ types/cert-host-key.d.ts | 8 + types/cert-x509.d.ts | 7 + types/cert.d.ts | 17 ++ types/checkout-options.d.ts | 27 +++ types/checkout.d.ts | 61 +++++++ types/cherry-pick-options.d.ts | 9 + types/cherry-pick.d.ts | 16 ++ types/clone-options.d.ts | 13 ++ types/clone.d.ts | 20 +++ types/commit.d.ts | 124 ++++++++++++++ types/config.d.ts | 24 +++ types/convenient-hunk.d.ts | 37 +++++ types/convenient-patch.d.ts | 73 ++++++++ types/cred-user-pass-payload.d.ts | 4 + types/cred-username.d.ts | 6 + types/cred.d.ts | 24 +++ types/cvar-map.d.ts | 5 + types/describe-format-options.d.ts | 7 + types/describe-options.d.ts | 9 + types/diff-binary-file.d.ts | 8 + types/diff-binary.d.ts | 15 ++ types/diff-delta.d.ts | 10 ++ types/diff-file.d.ts | 24 +++ types/diff-line.d.ts | 20 +++ types/diff-options.d.ts | 18 ++ types/diff-perf-data.d.ts | 5 + types/diff.d.ts | 157 ++++++++++++++++++ types/enums.d.ts | 41 +++++ types/error.d.ts | 68 ++++++++ types/fetch-options.d.ts | 13 ++ types/fetch.d.ts | 13 ++ types/filter.d.ts | 35 ++++ types/git-err.d.ts | 8 + types/graph.d.ts | 7 + types/hash-sig.d.ts | 17 ++ types/ignore.d.ts | 7 + types/index-entry.d.ts | 21 +++ types/index.d.ts | 105 ++++++++++++ types/index_.d.ts | 59 +++++++ types/indexer.d.ts | 9 + types/lib-git2.d.ts | 25 +++ types/merge-file-input.d.ts | 7 + types/merge-file-options.d.ts | 9 + types/merge-file-result.d.ts | 7 + types/merge-options.d.ts | 11 ++ types/merge.d.ts | 59 +++++++ types/note.d.ts | 19 +++ types/object.d.ts | 37 +++++ types/odb-expand-id.d.ts | 8 + types/odb-object.d.ts | 11 ++ types/odb.d.ts | 23 +++ types/oid-array.d.ts | 7 + types/oid.d.ts | 11 ++ types/open-ssl.d.ts | 3 + types/pack-builder.d.ts | 25 +++ types/package.json | 30 ++++ types/path-spec.d.ts | 34 ++++ types/proxy-options.d.ts | 9 + types/proxy.d.ts | 5 + types/push-options.d.ts | 12 ++ types/push-update.d.ts | 8 + types/push.d.ts | 6 + types/rebase-operation.d.ts | 18 ++ types/rebase.d.ts | 29 ++++ types/ref-db.d.ts | 9 + types/ref-log.d.ts | 24 +++ types/ref-spec.d.ts | 8 + types/reference.d.ts | 60 +++++++ types/remote-callbacks.d.ts | 8 + types/remote.d.ts | 71 ++++++++ types/repository.d.ts | 248 ++++++++++++++++++++++++++++ types/reset.d.ts | 30 ++++ types/rev-parse.d.ts | 16 ++ types/rev-walk.d.ts | 47 ++++++ types/revert.d.ts | 21 +++ types/signature.d.ts | 17 ++ types/stash.d.ts | 46 ++++++ types/status-entry.d.ts | 7 + types/status-file-options.d.ts | 8 + types/status-file.d.ts | 20 +++ types/status-list.d.ts | 12 ++ types/status-options.d.ts | 9 + types/status.d.ts | 56 +++++++ types/str-array.d.ts | 7 + types/submodule-update-options.d.ts | 10 ++ types/submodule.d.ts | 87 ++++++++++ types/tag.d.ts | 34 ++++ types/time.d.ts | 4 + types/transfer-progress.d.ts | 9 + types/transport.d.ts | 16 ++ types/tree-builder.d.ts | 15 ++ types/tree-entry.d.ts | 48 ++++++ types/tree-update.d.ts | 8 + types/tree.d.ts | 74 +++++++++ 105 files changed, 2837 insertions(+), 1 deletion(-) create mode 100644 types/LICENSE create mode 100644 types/README.md create mode 100644 types/annotated-commit.d.ts create mode 100644 types/attr.d.ts create mode 100644 types/blame-hunk.d.ts create mode 100644 types/blame-options.d.ts create mode 100644 types/blame.d.ts create mode 100644 types/blob.d.ts create mode 100644 types/branch.d.ts create mode 100644 types/buf.d.ts create mode 100644 types/cert-host-key.d.ts create mode 100644 types/cert-x509.d.ts create mode 100644 types/cert.d.ts create mode 100644 types/checkout-options.d.ts create mode 100644 types/checkout.d.ts create mode 100644 types/cherry-pick-options.d.ts create mode 100644 types/cherry-pick.d.ts create mode 100644 types/clone-options.d.ts create mode 100644 types/clone.d.ts create mode 100644 types/commit.d.ts create mode 100644 types/config.d.ts create mode 100644 types/convenient-hunk.d.ts create mode 100644 types/convenient-patch.d.ts create mode 100644 types/cred-user-pass-payload.d.ts create mode 100644 types/cred-username.d.ts create mode 100644 types/cred.d.ts create mode 100644 types/cvar-map.d.ts create mode 100644 types/describe-format-options.d.ts create mode 100644 types/describe-options.d.ts create mode 100644 types/diff-binary-file.d.ts create mode 100644 types/diff-binary.d.ts create mode 100644 types/diff-delta.d.ts create mode 100644 types/diff-file.d.ts create mode 100644 types/diff-line.d.ts create mode 100644 types/diff-options.d.ts create mode 100644 types/diff-perf-data.d.ts create mode 100644 types/diff.d.ts create mode 100644 types/enums.d.ts create mode 100644 types/error.d.ts create mode 100644 types/fetch-options.d.ts create mode 100644 types/fetch.d.ts create mode 100644 types/filter.d.ts create mode 100644 types/git-err.d.ts create mode 100644 types/graph.d.ts create mode 100644 types/hash-sig.d.ts create mode 100644 types/ignore.d.ts create mode 100644 types/index-entry.d.ts create mode 100644 types/index.d.ts create mode 100644 types/index_.d.ts create mode 100644 types/indexer.d.ts create mode 100644 types/lib-git2.d.ts create mode 100644 types/merge-file-input.d.ts create mode 100644 types/merge-file-options.d.ts create mode 100644 types/merge-file-result.d.ts create mode 100644 types/merge-options.d.ts create mode 100644 types/merge.d.ts create mode 100644 types/note.d.ts create mode 100644 types/object.d.ts create mode 100644 types/odb-expand-id.d.ts create mode 100644 types/odb-object.d.ts create mode 100644 types/odb.d.ts create mode 100644 types/oid-array.d.ts create mode 100644 types/oid.d.ts create mode 100644 types/open-ssl.d.ts create mode 100644 types/pack-builder.d.ts create mode 100644 types/package.json create mode 100644 types/path-spec.d.ts create mode 100644 types/proxy-options.d.ts create mode 100644 types/proxy.d.ts create mode 100644 types/push-options.d.ts create mode 100644 types/push-update.d.ts create mode 100644 types/push.d.ts create mode 100644 types/rebase-operation.d.ts create mode 100644 types/rebase.d.ts create mode 100644 types/ref-db.d.ts create mode 100644 types/ref-log.d.ts create mode 100644 types/ref-spec.d.ts create mode 100644 types/reference.d.ts create mode 100644 types/remote-callbacks.d.ts create mode 100644 types/remote.d.ts create mode 100644 types/repository.d.ts create mode 100644 types/reset.d.ts create mode 100644 types/rev-parse.d.ts create mode 100644 types/rev-walk.d.ts create mode 100644 types/revert.d.ts create mode 100644 types/signature.d.ts create mode 100644 types/stash.d.ts create mode 100644 types/status-entry.d.ts create mode 100644 types/status-file-options.d.ts create mode 100644 types/status-file.d.ts create mode 100644 types/status-list.d.ts create mode 100644 types/status-options.d.ts create mode 100644 types/status.d.ts create mode 100644 types/str-array.d.ts create mode 100644 types/submodule-update-options.d.ts create mode 100644 types/submodule.d.ts create mode 100644 types/tag.d.ts create mode 100644 types/time.d.ts create mode 100644 types/transfer-progress.d.ts create mode 100644 types/transport.d.ts create mode 100644 types/tree-builder.d.ts create mode 100644 types/tree-entry.d.ts create mode 100644 types/tree-update.d.ts create mode 100644 types/tree.d.ts diff --git a/package.json b/package.json index 22109fb56..9b4ebd61c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", "version": "0.25.0-alpha.9", - "homepage": "http://nodegit.org", + "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", "git2", @@ -11,6 +11,7 @@ ], "license": "MIT", "main": "dist/nodegit.js", + "types": "types/index.d.ts", "repository": { "type": "git", "url": "git://github.com/elastic/nodegit.git" diff --git a/types/LICENSE b/types/LICENSE new file mode 100644 index 000000000..4b1ad51b2 --- /dev/null +++ b/types/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. All rights reserved. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/types/README.md b/types/README.md new file mode 100644 index 000000000..4e9537c7d --- /dev/null +++ b/types/README.md @@ -0,0 +1,16 @@ +# Installation +> `npm install --save @types/nodegit` + +# Summary +This package contains type definitions for nodegit (https://github.com/nodegit/nodegit). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/nodegit + +Additional Details + * Last updated: Wed, 19 Dec 2018 18:17:49 GMT + * Dependencies: @types/node + * Global values: none + +# Credits +These definitions were written by Dolan Miu , Tobias Nießen . diff --git a/types/annotated-commit.d.ts b/types/annotated-commit.d.ts new file mode 100644 index 000000000..2cfa46195 --- /dev/null +++ b/types/annotated-commit.d.ts @@ -0,0 +1,19 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Reference } from './reference'; + +export class AnnotatedCommit { + /** + * @param repo - repository that contains the given commit + * @param branchName - name of the (remote) branch + * @param remoteUrl - url of the remote + * @param id - the commit object id of the remote branch + */ + static fromFetchhead(repo: Repository, branchName: string, remoteUrl: string, id: Oid): Promise; + static fromRef(repo: Repository, ref: Reference): Promise; + static fromRevspec(repo: Repository, revspec: string): Promise; + static lookup(repo: Repository, id: Oid): Promise; + + free(): void; + id(): Oid; +} diff --git a/types/attr.d.ts b/types/attr.d.ts new file mode 100644 index 000000000..a9c51ae8e --- /dev/null +++ b/types/attr.d.ts @@ -0,0 +1,38 @@ +import { Repository } from './repository'; + +export namespace Attr { + const enum STATES { + UNSPECIFIED_T = 0, + TRUE_T = 1, + FALSE_T = 2, + VALUE_T = 3 + } +} + +export class Attr { + static addMacro(repo: Repository, name: string, values: string): number; + static cacheFlush(repo: Repository): void; + /** + * @param repo - The repository containing the path. + * @param flags - A combination of GIT_ATTR_CHECK... flags. + * @param path - The path to check for attributes. Relative paths are interpreted relative to the repo root. + * The file does not have to exist, but if it does not, then it will be treated as a plain file (not a directory). + * @param name - The name of the attribute to look up. + * @returns - Output of the value of the attribute. Use the GIT_ATTR_... + */ + static get(repo: Repository, flags: number, path: string, name: string): Promise; + /** + * @param repo - The repository containing the path. + * @param flags - A combination of GIT_ATTR_CHECK... flags. + * @param path - The path to check for attributes. Relative paths are interpreted relative to the repo root. + * The file does not have to exist, but if it does not, then it will be treated as a plain file (not a directory). + * @param numAttr - The number of attributes being looked up + * @param names - An array of num_attr strings containing attribute names. + */ + static getMany(repo: Repository, flags: number, path: string, numAttr: number, names: string): any[]; + /** + * @param attr - The attribute + * @returns - the value type for the attribute + */ + static value(attr: string): number; +} diff --git a/types/blame-hunk.d.ts b/types/blame-hunk.d.ts new file mode 100644 index 000000000..58ab8e719 --- /dev/null +++ b/types/blame-hunk.d.ts @@ -0,0 +1,13 @@ +import { Oid } from './oid'; +import { Signature } from './signature'; + +export class BlameHunk { + linesInHunk: number; + finalCommitId: Oid; + finalStartLineNumber: number; + finalSignature: Signature; + origCommitId: Oid; + origPath: string; + origStartLineNumber: number; + origSignature: Signature; +} diff --git a/types/blame-options.d.ts b/types/blame-options.d.ts new file mode 100644 index 000000000..1fdc6f628 --- /dev/null +++ b/types/blame-options.d.ts @@ -0,0 +1,12 @@ +import { Oid } from './oid'; + +export class BlameOptions { + version?: number; + flags?: number; + minMatchCharacters?: number; + newestCommit?: Oid; + oldestCommit?: Oid; + minLine?: number; + maxLine?: number; + [key: string]: any; +} diff --git a/types/blame.d.ts b/types/blame.d.ts new file mode 100644 index 000000000..f88dda947 --- /dev/null +++ b/types/blame.d.ts @@ -0,0 +1,44 @@ +import { Repository } from './repository'; +import { BlameOptions } from './blame-options'; +import { BlameHunk } from './blame-hunk'; + +export namespace Blame { + const enum FLAG { + NORMAL = 0, + TRACK_COPIES_SAME_FILE = 1, + TRACK_COPIES_SAME_COMMIT_MOVES = 2, + TRACK_COPIES_SAME_COMMIT_COPIES = 4, + TRACK_COPIES_ANY_COMMIT_COPIES = 8, + FIRST_PARENT = 16 + } +} + +export class Blame { + /** + * Retrieve the blame of a file + * + * @param repo - Repository that contains the file + * @param path - to the file to get the blame of + * @param [options] - Options for the blame + */ + static file(repo: Repository, path: string, options?: BlameOptions): Blame; + /** + * @param opts - The git_blame_options struct to initialize + * @param version - Version of struct; pass GIT_BLAME_OPTIONS_VERSION + */ + static initOptions(opts: BlameOptions, version: number): number; + + buffer(buffer: string, bufferLen: number): Promise; + + free(): void; + /** + * @returns - the hunk at the given index, or NULL on error + */ + getHunkByIndex(index: number): BlameHunk; + /** + * @returns - the hunk that contains the given line, or NULL on error + */ + getHunkByLine(lineNo: number): BlameHunk; + + getHunkCount(): number; +} diff --git a/types/blob.d.ts b/types/blob.d.ts new file mode 100644 index 000000000..9d7320c93 --- /dev/null +++ b/types/blob.d.ts @@ -0,0 +1,41 @@ +import { WriteStream } from 'fs'; + +import { Repository } from './repository'; +import { Oid } from './oid'; + +export class Blob { + /** + * @param repo - repository where to blob will be written + * @param buffer - data to be written into the blob + * @param len - length of the data + * @returns - return the id of the written blob + */ + static createFromBuffer(repo: Repository, buffer: Buffer, len: number): Oid; + /** + * @param id - return the id of the written blob + * @param repo - repository where the blob will be written. this repository can be bare or not + * @param path - file from which the blob will be created + */ + static createFromDisk(id: Oid, repo: Repository, path: string): number; + static createFromStream(repo: Repository, hintPath: string): Promise; + /** + * @param id - return the id of the written blob + * @param repo - repository where the blob will be written. this repository cannot be bare + * @param relativePath - file from which the blob will be created, relative to the repository's working dir + * @returns - 0 or an error code + */ + static createFromWorkdir(id: Oid, repo: Repository, relativePath: string): number; + static lookup(repo: Repository, id: string | Oid | Blob): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + + free(): void; + id(): Oid; + isBinary(): number; + owner(): Repository; + rawcontent(): Buffer; + rawsize(): number; + content(): Buffer; + toString(): string; + filemode(): number; + dup(): Promise; +} diff --git a/types/branch.d.ts b/types/branch.d.ts new file mode 100644 index 000000000..71dc35b02 --- /dev/null +++ b/types/branch.d.ts @@ -0,0 +1,25 @@ +import { Repository } from './repository'; +import { Reference } from './reference'; +import { Commit } from './commit'; +import { AnnotatedCommit } from './annotated-commit'; + +export namespace Branch { + const enum BRANCH { + LOCAL = 1, + REMOTE = 2, + ALL = 3 + } +} + +export class Branch { + static create(repo: Repository, branchName: string, target: Commit, force: number): Promise; + static createFromAnnotated(repository: Repository, branchName: string, commit: AnnotatedCommit, force: number): Reference; + static delete(branch: Reference): number; + static isHead(branch: Reference): number; + static iteratorNew(repo: Repository, listFlags: number): Promise; + static lookup(repo: Repository, branchName: string, branchType: Branch.BRANCH): Promise; + static move(branch: Reference, newBranchName: string, force: number): Promise; + static name(ref: Reference): Promise; + static setUpstream(branch: Reference, upstreamName: string): Promise; + static upstream(branch: Reference): Promise; +} diff --git a/types/buf.d.ts b/types/buf.d.ts new file mode 100644 index 000000000..5aefac72c --- /dev/null +++ b/types/buf.d.ts @@ -0,0 +1,13 @@ +/// + +export class Buf { + containsNul(): number; + + free(): void; + grow(targetSize: number): Promise; + isBinary(): number; + set(data: Buffer, datalen: number): Promise; + ptr: string; + asize: number; + size: number; +} diff --git a/types/cert-host-key.d.ts b/types/cert-host-key.d.ts new file mode 100644 index 000000000..9932f6669 --- /dev/null +++ b/types/cert-host-key.d.ts @@ -0,0 +1,8 @@ +import { Cert } from './cert'; + +export class CertHostkey { + parent: Cert; + type: Cert.TYPE; + hashMd5: string; + hashSha1: string; +} diff --git a/types/cert-x509.d.ts b/types/cert-x509.d.ts new file mode 100644 index 000000000..44f6d5a7a --- /dev/null +++ b/types/cert-x509.d.ts @@ -0,0 +1,7 @@ +import { Cert } from './cert'; + +export class CertX509 { + data: Buffer; + len: number; + parent: Cert; +} diff --git a/types/cert.d.ts b/types/cert.d.ts new file mode 100644 index 000000000..fde86569b --- /dev/null +++ b/types/cert.d.ts @@ -0,0 +1,17 @@ +export namespace Cert { + const enum TYPE { + NONE = 0, + X509 = 1, + HOSTKEY_LIBSSH2 = 2, + STRARRAY = 3 + } + + const enum SSH { + MD5 = 1, + SHA1 = 2 + } +} + +export class Cert { + certType: Cert.TYPE; +} diff --git a/types/checkout-options.d.ts b/types/checkout-options.d.ts new file mode 100644 index 000000000..6971f59f3 --- /dev/null +++ b/types/checkout-options.d.ts @@ -0,0 +1,27 @@ +import { Strarray } from './str-array'; +import { Tree } from './tree'; +import { Index } from './index'; + +export class CheckoutOptions { + version?: number; + checkoutStrategy?: number; + disableFilters?: number; + dirMode?: number; + fileMode?: number; + fileOpenFlags?: number; + notifyFlags?: number; + notifyCb?: any; + notifyPayload?: undefined; + progressCb?: any; + progressPayload?: undefined; + paths?: Strarray | string | string[]; + baseline?: Tree; + baselineIndex?: Index; + targetDirectory?: string; + ancestorLabel?: string; + ourLabel?: string; + theirLabel?: string; + perfdataCb?: any; + perfdataPayload?: undefined; + [key: string]: any; +} diff --git a/types/checkout.d.ts b/types/checkout.d.ts new file mode 100644 index 000000000..c29dd2d22 --- /dev/null +++ b/types/checkout.d.ts @@ -0,0 +1,61 @@ +import { Repository } from './repository'; +import { CheckoutOptions } from './checkout-options'; +import { Reference } from './reference'; +import { Oid } from './oid'; +import { Tree } from './tree'; +import { Commit } from './commit'; +import { Index } from './index'; + +export namespace Checkout { + const enum NOTIFY { + NONE = 0, + CONFLICT = 1, + DIRTY = 2, + UPDATED = 4, + UNTRACKED = 8, + IGNORED = 16, + ALL = 65535 + } + + const enum STRATEGY { + NONE = 0, + SAFE = 1, + FORCE = 2, + RECREATE_MISSING = 4, + ALLOW_CONFLICTS = 16, + REMOVE_UNTRACKED = 32, + REMOVE_IGNORED = 64, + UPDATE_ONLY = 128, + DONT_UPDATE_INDEX = 256, + NO_REFRESH = 512, + SKIP_UNMERGED = 1024, + USE_OURS = 2048, + USE_THEIRS = 4096, + DISABLE_PATHSPEC_MATCH = 8192, + SKIP_LOCKED_DIRECTORIES = 262144, + DONT_OVERWRITE_IGNORED = 524288, + CONFLICT_STYLE_MERGE = 1048576, + CONFLICT_STYLE_DIFF3 = 2097152, + DONT_REMOVE_EXISTING = 4194304, + DONT_WRITE_INDEX = 8388608, + UPDATE_SUBMODULES = 65536, + UPDATE_SUBMODULES_IF_CHANGED = 131072 + } +} + +export class Checkout { + /** + * Patch head checkout to automatically coerce objects. + */ + static head(repo: Repository, options?: CheckoutOptions): Promise; + /** + * Patch index checkout to automatically coerce objects. + */ + static index(repo: Repository, The: Index, options?: CheckoutOptions): Promise; + + static initOptions(opts: CheckoutOptions, version: number): number; + /** + * Patch tree checkout to automatically coerce objects. + */ + static tree(repo: Repository, treeish: Oid | Tree | Commit | Reference, options?: CheckoutOptions): Promise; +} diff --git a/types/cherry-pick-options.d.ts b/types/cherry-pick-options.d.ts new file mode 100644 index 000000000..cde3c0a34 --- /dev/null +++ b/types/cherry-pick-options.d.ts @@ -0,0 +1,9 @@ +import { MergeOptions } from './merge-options'; +import { CheckoutOptions } from './checkout-options'; + +export interface CherrypickOptions { + version?: number; + mainline?: number; + mergeOpts?: MergeOptions; + checkoutOpts?: CheckoutOptions; +} diff --git a/types/cherry-pick.d.ts b/types/cherry-pick.d.ts new file mode 100644 index 000000000..168de79e3 --- /dev/null +++ b/types/cherry-pick.d.ts @@ -0,0 +1,16 @@ +import { Repository } from './repository'; +import { Commit } from './commit'; +import { MergeOptions } from './merge-options'; +import { CherrypickOptions } from './cherry-pick-options'; + +export class Cherrypick { + /** + * Cherrypick a commit and, changing the index and working directory + */ + static cherrypick(repo: Repository, commit: Commit, options?: CherrypickOptions): Promise; + /** + * Cherrypicks the given commit against "our" commit, producing an index that reflects the result of the cherrypick. The index is not backed by a repo. + */ + static commit(repo: Repository, cherrypickCommit: Commit, ourCommit: Commit, mainline: number, mergeOptions?: MergeOptions): Promise; + static initOptions(opts: CherrypickOptions, version: number): number; +} diff --git a/types/clone-options.d.ts b/types/clone-options.d.ts new file mode 100644 index 000000000..8535b28c8 --- /dev/null +++ b/types/clone-options.d.ts @@ -0,0 +1,13 @@ +import { CheckoutOptions } from './checkout-options'; +import { FetchOptions } from './fetch-options'; + +export class CloneOptions { + version?: number; + checkoutOpts?: CheckoutOptions; + fetchOpts?: FetchOptions; + bare?: number; + local?: number; + checkoutBranch?: string; + repositoryCbPayload?: any; + remoteCbPayload?: any; +} diff --git a/types/clone.d.ts b/types/clone.d.ts new file mode 100644 index 000000000..15933d412 --- /dev/null +++ b/types/clone.d.ts @@ -0,0 +1,20 @@ +import { Repository } from './repository'; +import { CloneOptions } from './clone-options'; + +export namespace Clone { + const enum LOCAL { + AUTO = 0, + LOCAL = 1, + NO_LOCAL = 2, + NO_LINKS = 3 + } +} + +export class Clone { + /** + * Patch repository cloning to automatically coerce objects. + */ + static clone(url: string, localPath: string, options?: CloneOptions): Promise; + + static initOptions(opts: CloneOptions, version: number): number; +} diff --git a/types/commit.d.ts b/types/commit.d.ts new file mode 100644 index 000000000..57e8c55d8 --- /dev/null +++ b/types/commit.d.ts @@ -0,0 +1,124 @@ +import { EventEmitter } from 'events'; + +import { Repository } from './repository'; +import { Signature } from './signature'; +import { Oid } from './oid'; +import { Buf } from './buf'; +import { Object } from './object'; +import { Tree } from './tree'; +import { TreeEntry } from './tree-entry'; +import { Diff } from './diff'; + +export interface HistoryEventEmitter extends EventEmitter { + start(): void; +} + +export class Commit { + static create(repo: Repository, updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree, parentCount: number, parents: any[]): Oid; + static createV(id: Oid, repo: Repository, updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree, parentCount: number): number; + /** + * Retrieves the commit pointed to by the oid + * + * + */ + static lookup(repo: Repository, id: string | Oid | Commit): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + static createWithSignature(repo: Repository, commitContent: string, signature: string, signatureField: string): Promise; + + amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree): Promise; + author(): Signature; + committer(): Signature; + + free(): void; + headerField(field: string): Promise; + id(): Oid; + message(): string; + messageEncoding(): string; + messageRaw(): string; + nthGenAncestor(n: number): Promise; + owner(): Repository; + parent(n: number): Promise; + parentId(n: number): Oid; + parentcount(): number; + rawHeader(): string; + summary(): string; + time(): number; + timeOffset(): number; + tree(treeOut: Tree): number; + treeId(): Oid; + /** + * Retrieve the SHA. + * + * + */ + sha(): string; + /** + * Retrieve the commit time as a unix timestamp. + * + * + */ + timeMs(): number; + /** + * Retrieve the commit time as a Date object. + * + * + */ + date(): Date; + /** + * Get the tree associated with this commit. + * + * + */ + getTree(): Promise; + /** + * Retrieve the entry represented by path for this commit. Path must be relative to repository root. + * + * + */ + getEntry(path: string): Promise; + /** + * Walk the history from this commit backwards. + * An EventEmitter is returned that will emit a "commit" event for each commit in the history, and one "end" + * event when the walk is completed. Don't forget to call start() on the returned EventEmitter. + * + * + */ + history(): HistoryEventEmitter; + /** + * Retrieve the commit's parents as commit objects. + * + * + */ + getParents(limit: number, callback?: Function): Promise; + /** + * Retrieve the commit's parent shas. + * + * + */ + parents(): Oid[]; + /** + * Generate an array of diff trees showing changes between this commit and its parent(s). + * + * + */ + getDiff(callback?: Function): Promise; + /** + * Generate an array of diff trees showing changes between this commit and its parent(s). + * + * + */ + getDiffWithOptions(options: Object, callback?: Function): Promise; + /** + * The sha of this commit + * + * + */ + toString(): string; + dup(): Promise; + /** + * consists of a summary + * + * + */ + body(): string; +} diff --git a/types/config.d.ts b/types/config.d.ts new file mode 100644 index 000000000..f03ea2392 --- /dev/null +++ b/types/config.d.ts @@ -0,0 +1,24 @@ +import { Buf } from './buf'; + +export namespace Config { + const enum LEVEL { + SYSTEM = 1, + XDG = 2, + GLOBAL = 3, + LOCAL = 4, + APP = 5, + HIGHEST_LEVEL = -1 + } +} + +export class Config { + static openDefault(): Promise; + static findProgramdata(): Promise; + + getStringBuf(name: string): Promise; + setInt64(name: string, value: number): number; + setMultivar(name: string, regexp: string, value: string): number; + setString(name: string, value: string): Promise; + snapshot(): Promise; + lock(transaction: any): number; +} diff --git a/types/convenient-hunk.d.ts b/types/convenient-hunk.d.ts new file mode 100644 index 000000000..a844fd4e9 --- /dev/null +++ b/types/convenient-hunk.d.ts @@ -0,0 +1,37 @@ +import { DiffLine } from './diff-line'; + +export class ConvenientHunk { + /** + * Diff header string that represents the context of this hunk + * of the diff. Something like `@@ -169,14 +167,12 @@ ...` + */ + header(): string; + /** + * The length of the header + */ + headerLen(): number; + /** + * The lines in this hunk + */ + lines(): Promise; + /** + * The number of new lines in the hunk + */ + newLines(): number; + /** + * The starting offset of the first new line in the file + */ + newStart(): number; + /** + * The number of old lines in the hunk + */ + oldLines(): number; + /** + * The starting offset of the first old line in the file + */ + oldStart(): number; + /** + * Number of lines in this hunk + */ + size(): number; +} diff --git a/types/convenient-patch.d.ts b/types/convenient-patch.d.ts new file mode 100644 index 000000000..05fa0def4 --- /dev/null +++ b/types/convenient-patch.d.ts @@ -0,0 +1,73 @@ +import { ConvenientHunk } from './convenient-hunk'; +import { DiffFile } from './diff-file'; + +export class ConvenientPatch { + /** + * Old attributes of the file + */ + oldFile(): DiffFile; + /** + * New attributes of the file + */ + newFile(): DiffFile; + /** + * The number of hunks in this patch + */ + size(): number; + /** + * The hunks in this patch + */ + hunks(): Promise; + /** + * The status of this patch (unmodified, added, deleted) + */ + status(): number; + /** + * The line statistics of this patch (#contexts, #added, #deleted) + */ + lineStats(): any; + /** + * Is this an unmodified patch? + */ + isUnmodified(): boolean; + /** + * Is this an added patch? + */ + isAdded(): boolean; + /** + * Is this a deleted patch? + */ + isDeleted(): boolean; + /** + * Is this an modified patch + */ + isModified(): boolean; + /** + * Is this a renamed patch? + */ + isRenamed(): boolean; + /** + * Is this a copied patch? + */ + isCopied(): boolean; + /** + * Is this an ignored patch? + */ + isIgnored(): boolean; + /** + * Is this an untracked patch? + */ + isUntracked(): boolean; + /** + * Is this a type change? + */ + isTypeChange(): boolean; + /** + * Is this an undreadable patch? + */ + isUnreadable(): boolean; + /** + * Is this a conflicted patch? + */ + isConflicted(): boolean; +} diff --git a/types/cred-user-pass-payload.d.ts b/types/cred-user-pass-payload.d.ts new file mode 100644 index 000000000..95beeb9f3 --- /dev/null +++ b/types/cred-user-pass-payload.d.ts @@ -0,0 +1,4 @@ +export class CredUserpassPayload { + username: string; + password: string; +} diff --git a/types/cred-username.d.ts b/types/cred-username.d.ts new file mode 100644 index 000000000..d7b619eb5 --- /dev/null +++ b/types/cred-username.d.ts @@ -0,0 +1,6 @@ +import { Cred } from './cred'; + +export class CredUsername { + parent: Cred; + username: string; +} diff --git a/types/cred.d.ts b/types/cred.d.ts new file mode 100644 index 000000000..160f62f90 --- /dev/null +++ b/types/cred.d.ts @@ -0,0 +1,24 @@ +export namespace Cred { + const enum TYPE { + USERPASS_PLAINTEXT = 1, + SSH_KEY = 2, + SSH_CUSTOM = 4, + DEFAULT = 8, + SSH_INTERACTIVE = 16, + USERNAME = 32, + SSH_MEMORY = 64 + } +} + +export class Cred { + static defaultNew(): Cred; + static sshKeyFromAgent(username: string): Cred; + static sshKeyMemoryNew(username: string, publicKey: string, privateKey: string, passphrase: string): Promise; + static sshKeyNew(username: string, publicKey: string, privateKey: string, passphrase: string): Cred; + static usernameNew(username: string): Promise; + static userpassPlaintextNew(username: string, password: string): Cred; + + hasUsername(): number; + + free(): void; +} diff --git a/types/cvar-map.d.ts b/types/cvar-map.d.ts new file mode 100644 index 000000000..f7c4b227d --- /dev/null +++ b/types/cvar-map.d.ts @@ -0,0 +1,5 @@ +export class CvarMap { + cvarType: number; + strMatch: string; + mapValue: number; +} diff --git a/types/describe-format-options.d.ts b/types/describe-format-options.d.ts new file mode 100644 index 000000000..b4213f0d6 --- /dev/null +++ b/types/describe-format-options.d.ts @@ -0,0 +1,7 @@ +export class DescribeFormatOptions { + version?: number; + abbreviatedSize?: number; + alwaysUseLongFormat?: number; + dirtySuffix?: string; + [key: string]: any; +} diff --git a/types/describe-options.d.ts b/types/describe-options.d.ts new file mode 100644 index 000000000..2934006a9 --- /dev/null +++ b/types/describe-options.d.ts @@ -0,0 +1,9 @@ +export class DescribeOptions { + version?: number; + maxCandidatesTags?: number; + describeStrategy?: number; + pattern?: string; + onlyFollowFirstParent?: number; + showCommitOidAsFallback?: number; + [key: string]: any; +} diff --git a/types/diff-binary-file.d.ts b/types/diff-binary-file.d.ts new file mode 100644 index 000000000..362e1a63f --- /dev/null +++ b/types/diff-binary-file.d.ts @@ -0,0 +1,8 @@ +import { Object } from './object'; + +export class DiffBinaryFile { + type: Object.TYPE; + data: string; + datalen: number; + inflatedlen: number; +} diff --git a/types/diff-binary.d.ts b/types/diff-binary.d.ts new file mode 100644 index 000000000..d5f7c6fd9 --- /dev/null +++ b/types/diff-binary.d.ts @@ -0,0 +1,15 @@ +import { DiffBinaryFile } from './diff-binary-file'; + +export namespace DiffBinary { + const enum DIFF_BINARY { + NONE = 0, + LITERAL = 1, + DELTA = 2 + } +} + +export class DiffBinary { + oldFile: DiffBinaryFile; + newFile: DiffBinaryFile; + containsData: DiffBinary.DIFF_BINARY; +} diff --git a/types/diff-delta.d.ts b/types/diff-delta.d.ts new file mode 100644 index 000000000..c21d98f43 --- /dev/null +++ b/types/diff-delta.d.ts @@ -0,0 +1,10 @@ +import { DiffFile } from './diff-file'; + +export class DiffDelta { + status: number; + flags: number; + similarity: number; + nfiles: number; + oldFile: DiffFile; + newFile: DiffFile; +} diff --git a/types/diff-file.d.ts b/types/diff-file.d.ts new file mode 100644 index 000000000..9f418ccd1 --- /dev/null +++ b/types/diff-file.d.ts @@ -0,0 +1,24 @@ +import { Oid } from './oid'; + +export class DiffFile { + /** + * Returns the file's flags + */ + flags(): number; + /** + * Returns the file's Oid + */ + id(): Oid; + /** + * Returns the file's mode + */ + mode(): number; + /** + * Returns the file's path + */ + path(): string; + /** + * Returns the file's size + */ + size(): number; +} diff --git a/types/diff-line.d.ts b/types/diff-line.d.ts new file mode 100644 index 000000000..7d1c07134 --- /dev/null +++ b/types/diff-line.d.ts @@ -0,0 +1,20 @@ +export class DiffLine { + /** + * The relevant line + * + * + */ + content(): string; + /** + * The non utf8 translated text + * + * + */ + rawContent(): string; + origin(): number; + oldLineno(): number; + newLineno(): number; + numLines(): number; + contentLen(): number; + contentOffset(): number; +} diff --git a/types/diff-options.d.ts b/types/diff-options.d.ts new file mode 100644 index 000000000..3925f5c70 --- /dev/null +++ b/types/diff-options.d.ts @@ -0,0 +1,18 @@ +import { Strarray } from './str-array'; + +export interface DiffOptions { + version?: number; + flags?: number; + ignoreSubmodules?: number; + pathspec?: Strarray | string | string[]; + notifyCb?: Function; + contextLines?: number; + interhunkLines?: number; + idAbbrev?: number; + maxSize?: number; + oldPrefix?: string; + newPrefix?: string; + payload?: any; + progressCb?: any; + [key: string]: any; +} diff --git a/types/diff-perf-data.d.ts b/types/diff-perf-data.d.ts new file mode 100644 index 000000000..5dfca0967 --- /dev/null +++ b/types/diff-perf-data.d.ts @@ -0,0 +1,5 @@ +export class DiffPerfdata { + version: number; + statCalls: number; + oidCalculations: number; +} diff --git a/types/diff.d.ts b/types/diff.d.ts new file mode 100644 index 000000000..62de0de6c --- /dev/null +++ b/types/diff.d.ts @@ -0,0 +1,157 @@ +import { Blob } from './blob'; +import { Repository } from './repository'; +import { Tree } from './tree'; +import { Strarray } from './str-array'; +import { Index } from './index_'; +import { DiffDelta } from './diff-delta'; +import { DiffPerfdata } from './diff-perf-data'; +import { DiffOptions } from './diff-options'; +import { Buf } from './buf'; +import { ConvenientPatch } from './convenient-patch'; + +export interface DiffFindOptions { + version?: number; + flags?: number; + renameThreshold?: number; + renameFromRewriteThreshold?: number; + copyThreshold?: number; + breakRewriteThreshold?: number; + renameLimit?: number; +} + +export namespace Diff { + const enum DELTA { + UNMODIFIED = 0, + ADDED = 1, + DELETED = 2, + MODIFIED = 3, + RENAMED = 4, + COPIED = 5, + IGNORED = 6, + UNTRACKED = 7, + TYPECHANGE = 8, + UNREADABLE = 9, + CONFLICTED = 10 + } + + const enum FIND { + BY_CONFIG = 0, + RENAMES = 1, + RENAMES_FROM_REWRITES = 2, + COPIES = 4, + COPIES_FROM_UNMODIFIED = 8, + REWRITES = 16, + BREAK_REWRITES = 32, + AND_BREAK_REWRITES = 48, + FOR_UNTRACKED = 64, + ALL = 255, + IGNORE_LEADING_WHITESPACE = 0, + IGNORE_WHITESPACE = 4096, + DONT_IGNORE_WHITESPACE = 8192, + EXACT_MATCH_ONLY = 16384, + BREAK_REWRITES_FOR_RENAMES_ONLY = 32768, + REMOVE_UNMODIFIED = 65536 + } + + const enum FLAG { + BINARY = 1, + NOT_BINARY = 2, + VALID_ID = 4, + EXISTS = 8 + } + + const enum FORMAT { + PATCH = 1, + PATCH_HEADER = 2, + RAW = 3, + NAME_ONLY = 4, + NAME_STATUS = 5 + } + + const enum FORMAT_EMAIL_FLAGS { + FORMAT_EMAIL_NONE = 0, + FORMAT_EMAIL_EXCLUDE_SUBJECT_PATCH_MARKER = 1 + } + + const enum LINE { + CONTEXT = 32, + ADDITION = 43, + DELETION = 45, + CONTEXT_EOFNL = 61, + ADD_EOFNL = 62, + DEL_EOFNL = 60, + FILE_HDR = 70, + HUNK_HDR = 72, + BINARY = 66 + } + + const enum OPTION { + NORMAL = 0, + REVERSE = 1, + INCLUDE_IGNORED = 2, + RECURSE_IGNORED_DIRS = 4, + INCLUDE_UNTRACKED = 8, + RECURSE_UNTRACKED_DIRS = 16, + INCLUDE_UNMODIFIED = 32, + INCLUDE_TYPECHANGE = 64, + INCLUDE_TYPECHANGE_TREES = 128, + IGNORE_FILEMODE = 256, + IGNORE_SUBMODULES = 512, + IGNORE_CASE = 1024, + INCLUDE_CASECHANGE = 2048, + DISABLE_PATHSPEC_MATCH = 4096, + SKIP_BINARY_CHECK = 8192, + ENABLE_FAST_UNTRACKED_DIRS = 16384, + UPDATE_INDEX = 32768, + INCLUDE_UNREADABLE = 65536, + INCLUDE_UNREADABLE_AS_UNTRACKED = 131072, + FORCE_TEXT = 1048576, + FORCE_BINARY = 2097152, + IGNORE_WHITESPACE = 4194304, + IGNORE_WHITESPACE_CHANGE = 8388608, + IGNORE_WHITESPACE_EOL = 16777216, + SHOW_UNTRACKED_CONTENT = 33554432, + SHOW_UNMODIFIED = 67108864, + PATIENCE = 268435456, + MINIMAL = 536870912, + SHOW_BINARY = 1073741824 + } + + const enum STATS_FORMAT { + STATS_NONE = 0, + STATS_FULL = 1, + STATS_SHORT = 2, + STATS_NUMBER = 4, + STATS_INCLUDE_SUMMARY = 8 + } +} + +export class Diff { + /** + * Directly run a diff between a blob and a buffer. + * + * + */ + static blobToBuffer(oldBlob: Blob, oldAsPath: string, + buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; + static fromBuffer(content: string, contentLen: number): Promise; + static indexToWorkdir(repo: Repository, index: Index, opts?: DiffOptions): Promise; + static indexToIndex(repo: Repository, oldIndex: Index, newIndex: Index, opts?: DiffOptions): Promise; + static treeToIndex(repo: Repository, oldTree: Tree, index: Index, opts?: DiffOptions): Promise; + static treeToTree(repo: Repository, oldTree: Tree, new_tree: Tree, opts?: DiffOptions): Promise; + static treeToWorkdir(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise; + static treeToWorkdirWithIndex(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise; + + findSimilar(options: DiffFindOptions): Promise; + getDelta(idx: number): DiffDelta; + getPerfdata(): Promise; + numDeltas(): number; + /** + * Retrieve patches in this difflist + * + * + */ + patches(): Promise; + merge(from: Diff): Promise; + toBuf(format: Diff.FORMAT): Promise; +} diff --git a/types/enums.d.ts b/types/enums.d.ts new file mode 100644 index 000000000..4fb44850c --- /dev/null +++ b/types/enums.d.ts @@ -0,0 +1,41 @@ +export namespace Enums { + const enum CVAR { + FALSE = 0, + TRUE = 1, + INT32 = 2, + string = 3 + } + + const enum DIRECTION { + FETCH = 0, + PUSH = 1 + } + + const enum FEATURE { + THREADS = 1, + HTTPS = 2, + SSH = 4 + } + + const enum IDXENTRY_EXTENDED_FLAG { + IDXENTRY_INTENT_TO_ADD = 8192, + IDXENTRY_SKIP_WORKTREE = 16384, + IDXENTRY_EXTENDED2 = 32768, + S = 24576, + IDXENTRY_UPDATE = 1, + IDXENTRY_REMOVE = 2, + IDXENTRY_UPTODATE = 4, + IDXENTRY_ADDED = 8, + IDXENTRY_HASHED = 16, + IDXENTRY_UNHASHED = 32, + IDXENTRY_WT_REMOVE = 64, + IDXENTRY_CONFLICTED = 128, + IDXENTRY_UNPACKED = 256, + IDXENTRY_NEW_SKIP_WORKTREE = 512 + } + + const enum INDXENTRY_FLAG { + IDXENTRY_EXTENDED = 16384, + IDXENTRY_VALID = 32768 + } +} diff --git a/types/error.d.ts b/types/error.d.ts new file mode 100644 index 000000000..c259749e8 --- /dev/null +++ b/types/error.d.ts @@ -0,0 +1,68 @@ +export namespace Error { + const enum ERROR { + GITERR_NONE = 0, + GITERR_NOMEMORY = 1, + GITERR_OS = 2, + GITERR_INVALID = 3, + GITERR_REFERENCE = 4, + GITERR_ZLIB = 5, + GITERR_REPOSITORY = 6, + GITERR_CONFIG = 7, + GITERR_REGEX = 8, + GITERR_ODB = 9, + GITERR_INDEX = 10, + GITERR_OBJECT = 11, + GITERR_NET = 12, + GITERR_TAG = 13, + GITERR_TREE = 14, + GITERR_INDEXER = 15, + GITERR_SSL = 16, + GITERR_SUBMODULE = 17, + GITERR_THREAD = 18, + GITERR_STASH = 19, + GITERR_CHECKOUT = 20, + GITERR_FETCHHEAD = 21, + GITERR_MERGE = 22, + GITERR_SSH = 23, + GITERR_FILTER = 24, + GITERR_REVERT = 25, + GITERR_CALLBACK = 26, + GITERR_CHERRYPICK = 27, + GITERR_DESCRIBE = 28, + GITERR_REBASE = 29, + GITERR_FILESYSTEM = 30 + } + + const enum CODE { + OK = 0, + ERROR = -1, + ENOTFOUND = -3, + EEXISTS = -4, + EAMBIGUOUS = -5, + EBUFS = -6, + EUSER = -7, + EBAREREPO = -8, + EUNBORNBRANCH = -9, + EUNMERGED = -10, + ENONFASTFORWARD = -11, + EINVALIDSPEC = -12, + ECONFLICT = -13, + ELOCKED = -14, + EMODIFIED = -15, + EAUTH = -16, + ECERTIFICATE = -17, + EAPPLIED = -18, + EPEEL = -19, + EEOF = -20, + EINVALID = -21, + EUNCOMMITTED = -22, + EDIRECTORY = -23, + PASSTHROUGH = -30, + ITEROVER = -31 + } +} + +export class Error { + message: string; + klass: number; +} diff --git a/types/fetch-options.d.ts b/types/fetch-options.d.ts new file mode 100644 index 000000000..6907db6bc --- /dev/null +++ b/types/fetch-options.d.ts @@ -0,0 +1,13 @@ +import { RemoteCallbacks } from './remote-callbacks'; +import { Strarray } from './str-array'; + +export interface FetchOptions { + version?: number; + callbacks?: RemoteCallbacks; + prune?: number; + updateFetchhead?: number; + downloadTags?: number; + customHeaders?: Strarray | string | string[]; + proxyOpts?: any; + [key: string]: any; +} diff --git a/types/fetch.d.ts b/types/fetch.d.ts new file mode 100644 index 000000000..db0980586 --- /dev/null +++ b/types/fetch.d.ts @@ -0,0 +1,13 @@ +import { FetchOptions } from './fetch-options'; + +export namespace Fetch { + const enum PRUNE { + GIT_FETCH_PRUNE_UNSPECIFIED = 0, + GIT_FETCH_PRUNE = 1, + GIT_FETCH_NO_PRUNE = 2 + } +} + +export class Fetch { + static initOptions(opts: FetchOptions, version: number): number; +} diff --git a/types/filter.d.ts b/types/filter.d.ts new file mode 100644 index 000000000..066a51183 --- /dev/null +++ b/types/filter.d.ts @@ -0,0 +1,35 @@ +import { WriteStream } from 'fs'; + +import { Repository } from './repository'; +import { Blob } from './blob'; +import { Buf } from './buf'; + +export namespace Filter { + const enum FLAG { + DEFAULT = 0, + ALLOW_UNSAFE = 1 + } + + const enum MODE { + TO_WORKTREE = 0, + SMUDGE = 0, + TO_ODB = 1, + CLEAN = 1 + } +} + +export class Filter { + static listContains(filters: any, name: string): number; + static listLength(fl: any): number; + static listNew(repo: Repository, mode: number, options: number): Promise; + static listStreamBlob(filters: any, blob: Blob, target: WriteStream): number; + static listStreamData(filters: any, data: Buf, target: WriteStream): number; + static listStreamFile(filters: any, repo: Repository, path: string, target: WriteStream): number; + static unregister(name: string): number; + + lookup(name: string): Filter; + register(name: string, priority: number): number; + version: number; + attributes: string; + stream: Function; +} diff --git a/types/git-err.d.ts b/types/git-err.d.ts new file mode 100644 index 000000000..1ba843423 --- /dev/null +++ b/types/git-err.d.ts @@ -0,0 +1,8 @@ +import { Error } from './error'; + +export class Giterr { + static errClear(): void; + static errLast(): Error; + static errSetOom(): void; + static errSetString(errorClass: number, string: string): void; +} diff --git a/types/graph.d.ts b/types/graph.d.ts new file mode 100644 index 000000000..d16d7b5de --- /dev/null +++ b/types/graph.d.ts @@ -0,0 +1,7 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; + +export class Graph { + static aheadBehind(repo: Repository, local: Oid, upstream: Oid): Promise; + static descendantOf(repo: Repository, commit: Oid, ancestor: Oid): Promise; +} diff --git a/types/hash-sig.d.ts b/types/hash-sig.d.ts new file mode 100644 index 000000000..229d26d78 --- /dev/null +++ b/types/hash-sig.d.ts @@ -0,0 +1,17 @@ +export namespace Hashsig { + const enum OPTION { + NORMAL = 0, + IGNORE_WHITESPACE = 1, + SMART_WHITESPACE = 2, + ALLOW_SMALL_FILES = 4 + } +} + +export class Hashsig { + static create(buf: string, buflen: number, opts: number): Promise; + static createFromFile(path: string, opts: number): Promise; + + compare(b: Hashsig): number; + + free(): void; +} diff --git a/types/ignore.d.ts b/types/ignore.d.ts new file mode 100644 index 000000000..c38d84d1f --- /dev/null +++ b/types/ignore.d.ts @@ -0,0 +1,7 @@ +import { Repository } from './repository'; + +export class Ignore { + static addRule(repo: Repository, rules: string): number; + static clearInternalRules(repo: Repository): number; + static pathIsIgnored(repo: Repository, path: string): Promise; +} diff --git a/types/index-entry.d.ts b/types/index-entry.d.ts new file mode 100644 index 000000000..b121b7a82 --- /dev/null +++ b/types/index-entry.d.ts @@ -0,0 +1,21 @@ +import { Oid } from './oid'; + +export interface IndexTime { + seconds: number; + nanoseconds: number; +} + +export class IndexEntry { + ctime: IndexTime; + mtime: IndexTime; + dev: number; + ino: number; + mode: number; + uid: number; + gid: number; + fileSize: number; + id: Oid; + flags: number; + flagsExtended: number; + path: string; +} diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 000000000..d1afcd6ea --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,105 @@ +// Type definitions for nodegit 0.22 +// Project: https://github.com/nodegit/nodegit +// Definitions by: Dolan Miu , Tobias Nießen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export { AnnotatedCommit } from './annotated-commit'; +export { Attr } from './attr'; +export { BlameHunk } from './blame-hunk'; +export { BlameOptions } from './blame-options'; +export { Blame } from './blame'; +export { Blob } from './blob'; +export { Branch } from './branch'; +export { Buf } from './buf'; +export { CertHostkey } from './cert-host-key'; +export { CertX509 } from './cert-x509'; +export { Cert } from './cert'; +export { CheckoutOptions } from './checkout-options'; +export { Checkout } from './checkout'; +export { CherrypickOptions } from './cherry-pick-options'; +export { Cherrypick } from './cherry-pick'; +export { CloneOptions } from './clone-options'; +export { Clone } from './clone'; +export { Commit } from './commit'; +export { Config } from './config'; +export { ConvenientHunk } from './convenient-hunk'; +export { ConvenientPatch } from './convenient-patch'; +export { CredUserpassPayload } from './cred-user-pass-payload'; +export { CredUsername } from './cred-username'; +export { Cred } from './cred'; +export { CvarMap } from './cvar-map'; +export { DescribeFormatOptions } from './describe-format-options'; +export { DescribeOptions } from './describe-options'; +export { DiffBinaryFile } from './diff-binary-file'; +export { DiffBinary } from './diff-binary'; +export { DiffDelta } from './diff-delta'; +export { DiffFile } from './diff-file'; +export { DiffLine } from './diff-line'; +export { DiffOptions } from './diff-options'; +export { DiffPerfdata } from './diff-perf-data'; +export { Diff, DiffFindOptions } from './diff'; +export { Enums } from './enums'; +export { Error } from './error'; +export { FetchOptions } from './fetch-options'; +export { Fetch } from './fetch'; +export { Filter } from './filter'; +export { Giterr } from './git-err'; +export { Graph } from './graph'; +export { Hashsig } from './hash-sig'; +export { Index } from './index_'; +export { IndexEntry } from './index-entry'; +export { Ignore } from './ignore'; +export { Indexer } from './indexer'; +export { Libgit2 } from './lib-git2'; +export { MergeFileInput } from './merge-file-input'; +export { MergeFileOptions } from './merge-file-options'; +export { MergeFileResult } from './merge-file-result'; +export { MergeOptions } from './merge-options'; +export { Merge } from './merge'; +export { Note } from './note'; +export { Object } from './object'; +export { OdbExpandId } from './odb-expand-id'; +export { OdbObject } from './odb-object'; +export { Odb } from './odb'; +export { Oidarray } from './oid-array'; +export { Oid } from './oid'; +export { Openssl } from './open-ssl'; +export { Packbuilder } from './pack-builder'; +export { Pathspec } from './path-spec'; +export { ProxyOptions } from './proxy-options'; +export { Proxy } from './proxy'; +export { PushOptions } from './push-options'; +export { PushUpdate } from './push-update'; +export { Push } from './push'; +export { RebaseOperation } from './rebase-operation'; +export { Rebase, RebaseOptions } from './rebase'; +export { Refdb } from './ref-db'; +export { Reflog, ReflogEntry } from './ref-log'; +export { Refspec } from './ref-spec'; +export { Reference } from './reference'; +export { RemoteCallbacks } from './remote-callbacks'; +export { Remote } from './remote'; +export { Repository } from './repository'; +export { Reset } from './reset'; +export { Revparse } from './rev-parse'; +export { Revwalk } from './rev-walk'; +export { Revert } from './revert'; +export { Signature } from './signature'; +export { Stash } from './stash'; +export { StatusEntry } from './status-entry'; +export { StatusFileOptions } from './status-file-options'; +export { StatusFile } from './status-file'; +export { StatusList } from './status-list'; +export { StatusOptions } from './status-options'; +export { Status } from './status'; +export { Strarray } from './str-array'; +export { SubmoduleUpdateOptions } from './submodule-update-options'; +export { Submodule } from './submodule'; +export { Tag } from './tag'; +export { Time } from './time'; +export { TransferProgress } from './transfer-progress'; +export { Transport } from './transport'; +export { Treebuilder } from './tree-builder'; +export { TreeEntry } from './tree-entry'; +export { TreeUpdate } from './tree-update'; +export { Tree } from './tree'; diff --git a/types/index_.d.ts b/types/index_.d.ts new file mode 100644 index 000000000..932691a89 --- /dev/null +++ b/types/index_.d.ts @@ -0,0 +1,59 @@ +import { Oid } from './oid'; +import { IndexEntry } from './index-entry'; +import { Repository } from './repository'; +import { Tree } from './tree'; +import { Strarray } from './str-array'; + +export namespace Index { + const enum ADD_OPTION { + ADD_DEFAULT = 0, + ADD_FORCE = 1, + ADD_DISABLE_PATHSPEC_MATCH = 2, + ADD_CHECK_PATHSPEC = 4 + } + + const enum CAP { + IGNORE_CASE = 1, + NO_FILEMODE = 2, + NO_SYMLINKS = 4, + FROM_OWNER = -1 + } +} + +export class Index { + static entryIsConflict(entry: IndexEntry): boolean; + static entryStage(entry: IndexEntry): number; + static open(indexPath: string): Promise; + + add(sourceEntry: IndexEntry): number; + addAll(pathspec: Strarray | string | string[], flags: number, callback?: Function): Promise; + addByPath(path: string): Promise; + caps(): number; + checksum(): Oid; + clear(): number; + conflictAdd(ancestorEntry: IndexEntry, ourEntry: IndexEntry, theirEntry: IndexEntry): number; + conflictCleanup(): number; + conflictGet(path: string): Promise; + conflictRemove(path: string): number; + entryCount(): number; + getByIndex(n: number): IndexEntry; + getByPath(path: string, stage?: number): IndexEntry; + hasConflicts(): boolean; + owner(): Repository; + path(): string; + read(force: number): number; + readTree(tree: Tree): number; + remove(path: string, stage: number): number; + removeAll(pathspec: Strarray | string | string[], callback?: Function): Promise; + removeByPath(path: string): Promise; + removeDirectory(dir: string, stage: number): number; + setCaps(caps: number): number; + updateAll(pathspec: Strarray | string | string[], callback?: Function): Promise; + write(): number; + writeTree(): Promise; + writeTreeTo(repo: Repository): Promise; + entries(): IndexEntry[]; + findPrefix(atPos: number, prefix: string): number; + setVersion(version: number): number; + version(): number; +} diff --git a/types/indexer.d.ts b/types/indexer.d.ts new file mode 100644 index 000000000..d4d3210bf --- /dev/null +++ b/types/indexer.d.ts @@ -0,0 +1,9 @@ +import { TransferProgress } from './transfer-progress'; +import { Oid } from './oid'; + +export class Indexer { + commit(stats: TransferProgress): number; + + free(): void; + hash(): Oid; +} diff --git a/types/lib-git2.d.ts b/types/lib-git2.d.ts new file mode 100644 index 000000000..be5a5d185 --- /dev/null +++ b/types/lib-git2.d.ts @@ -0,0 +1,25 @@ +export namespace Libgit2 { + const enum OPT { + GET_MWINDOW_SIZE = 0, + SET_MWINDOW_SIZE = 1, + GET_MWINDOW_MAPPED_LIMIT = 2, + SET_MWINDOW_MAPPED_LIMIT = 3, + GET_SEARCH_PATH = 4, + SET_SEARCH_PATH = 5, + SET_CACHE_OBJECT_LIMIT = 6, + SET_CACHE_MAX_SIZE = 7, + ENABLE_CACHING = 8, + GET_CACHED_MEMORY = 9, + GET_TEMPLATE_PATH = 10, + SET_TEMPLATE_PATH = 11, + SET_SSL_CERT_LOCATIONS = 12 + } +} + +export class Libgit2 { + static features(): number; + static init(): number; + static opts(option: number): number; + static shutdown(): number; + static version(major: number, minor: number, rev: number): void; +} diff --git a/types/merge-file-input.d.ts b/types/merge-file-input.d.ts new file mode 100644 index 000000000..f49bd446c --- /dev/null +++ b/types/merge-file-input.d.ts @@ -0,0 +1,7 @@ +export interface MergeFileInput { + version: number; + ptr: string; + size: number; + path: string; + mode: number; +} diff --git a/types/merge-file-options.d.ts b/types/merge-file-options.d.ts new file mode 100644 index 000000000..861abaf9b --- /dev/null +++ b/types/merge-file-options.d.ts @@ -0,0 +1,9 @@ +export interface MergeFileOptions { + version?: number; + ancestorLabel?: string; + ourLabel?: string; + theirLabel?: string; + favor?: number; + flags?: number; + [key: string]: any; +} diff --git a/types/merge-file-result.d.ts b/types/merge-file-result.d.ts new file mode 100644 index 000000000..e6f2efcc3 --- /dev/null +++ b/types/merge-file-result.d.ts @@ -0,0 +1,7 @@ +export class MergeFileResult { + automergeable: number; + path: string; + mode: number; + ptr: string; + len: number; +} diff --git a/types/merge-options.d.ts b/types/merge-options.d.ts new file mode 100644 index 000000000..514942200 --- /dev/null +++ b/types/merge-options.d.ts @@ -0,0 +1,11 @@ +export class MergeOptions { + version?: number; + renameThreshold?: number; + targetLimit?: number; + fileFavor?: number; + fileFlags?: number; + defaultDriver?: string; + flags?: number; + recursionLimit?: number; + [key: string]: any; +} diff --git a/types/merge.d.ts b/types/merge.d.ts new file mode 100644 index 000000000..4233b725e --- /dev/null +++ b/types/merge.d.ts @@ -0,0 +1,59 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Tree } from './tree'; +import { Commit } from './commit'; +import { Index } from './index'; +import { AnnotatedCommit } from './annotated-commit'; +import { CheckoutOptions } from './checkout-options'; +import { Oidarray } from './oid-array'; +import { MergeOptions } from './merge-options'; +import { MergeFileInput } from './merge-file-input'; + +export namespace Merge { + const enum ANALYSIS { + NONE = 0, + NORMAL = 1, + UP_TO_DATE = 2, + FASTFORWARD = 4, + UNBORN = 8 + } + + const enum FILE_FAVOR { + NORMAL = 0, + OURS = 1, + THEIRS = 2, + UNION = 3 + } + + const enum FILE_FLAGS { + FILE_DEFAULT = 0, + FILE_STYLE_MERGE = 1, + FILE_STYLE_DIFF3 = 2, + FILE_SIMPLIFY_ALNUM = 4, + FILE_IGNORE_WHITESPACE = 8, + FILE_IGNORE_WHITESPACE_CHANGE = 16, + FILE_IGNORE_WHITESPACE_EOL = 32, + FILE_DIFF_PATIENCE = 64, + FILE_DIFF_MINIMAL = 128 + } + + const enum PREFERENCE { + NONE = 0, + NO_FASTFORWARD = 1, + FASTFORWARD_ONLY = 2 + } + + const enum TREE_FLAG { + TREE_FIND_RENAMES = 1 + } +} + +export class Merge { + static merge(repo: Repository, theirHead: AnnotatedCommit, mergeOpts?: MergeOptions, checkoutOpts?: CheckoutOptions): any; + static base(repo: Repository, one: Oid, two: Oid): Promise; + static bases(repo: Repository, one: Oid, two: Oid): Promise; + static commits(repo: Repository, ourCommit: Commit, theirCommit: Commit, options?: MergeOptions): any; + static fileInitInput(opts: MergeFileInput, version: number): number; + static initOptions(opts: MergeOptions, version: number): number; + static trees(repo: Repository, ancestorTree: Tree, ourTree: Tree, theirTree: Tree, opts?: MergeOptions): Promise; +} diff --git a/types/note.d.ts b/types/note.d.ts new file mode 100644 index 000000000..b2c196c3b --- /dev/null +++ b/types/note.d.ts @@ -0,0 +1,19 @@ +import { Repository } from './repository'; +import { Signature } from './signature'; +import { Oid } from './oid'; + +export class Note { + static create(repo: Repository, notesRef: string, author: Signature, committer: Signature, oid: Oid, note: string, force: number): Promise; + static foreach(repo: Repository, notesRef: string, noteCb: Function, payload: any): Promise; + static iteratorNew(repo: Repository, notesRef: string): Promise; + static next(noteId: Oid, annotatedId: Oid, it: any): number; + static read(repo: Repository, notesRef: string, oid: Oid): Promise; + static remove(repo: Repository, notesRef: string, author: Signature, committer: Signature, oid: Oid): Promise; + + author(): Signature; + committer(): Signature; + + free(): void; + id(): Oid; + message(): string; +} diff --git a/types/object.d.ts b/types/object.d.ts new file mode 100644 index 000000000..be7e879b9 --- /dev/null +++ b/types/object.d.ts @@ -0,0 +1,37 @@ +import { Oid } from './oid'; +import { Repository } from './repository'; +import { Buf } from './buf'; + +export class Object { + static size(type: Object.TYPE): number; + static lookup(repo: Repository, id: Oid, type: Object.TYPE): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number, type: Object.TYPE): Promise; + static string2Type(str: string): Object.TYPE; + static type2String(type: Object.TYPE): string; + static typeisloose(type: Object.TYPE): number; + + dup(): Promise; + + free(): void; + id(): Oid; + lookupByPath(path: string, type: Object.TYPE): Promise; + owner(): Repository; + peel(targetType: number): Promise; + shortId(): Promise; + type(): number; +} + +export namespace Object { + const enum TYPE { + ANY = -2, + BAD = -1, + EXT1 = 0, + COMMIT = 1, + TREE = 2, + BLOB = 3, + TAG = 4, + EXT2 = 5, + OFS_DELTA = 6, + REF_DELTA = 7 + } +} diff --git a/types/odb-expand-id.d.ts b/types/odb-expand-id.d.ts new file mode 100644 index 000000000..5576fbad5 --- /dev/null +++ b/types/odb-expand-id.d.ts @@ -0,0 +1,8 @@ +import { Oid } from './oid'; +import { Object } from './object'; + +export class OdbExpandId { + id: Oid; + length: number; + type: Object.TYPE; +} diff --git a/types/odb-object.d.ts b/types/odb-object.d.ts new file mode 100644 index 000000000..9685f2821 --- /dev/null +++ b/types/odb-object.d.ts @@ -0,0 +1,11 @@ +import { Oid } from './oid'; + +export class OdbObject { + data(): Buffer; + dup(): Promise; + + free(): void; + id(): Oid; + size(): number; + type(): number; +} diff --git a/types/odb.d.ts b/types/odb.d.ts new file mode 100644 index 000000000..e5348d088 --- /dev/null +++ b/types/odb.d.ts @@ -0,0 +1,23 @@ +import { Oid } from './oid'; +import { OdbObject } from './odb-object'; +import { OdbExpandId } from './odb-expand-id'; +import { Object } from './object'; + +export namespace Odb { + const enum STREAM { + RDONLY = 2, + WRONLY = 4, + RW = 6 + } +} + +export class Odb { + static open(objectsDir: string): Promise; + + addDiskAlternate(path: string): number; + + free(): void; + read(id: Oid): Promise; + write(data: Buffer, len: number, type: Object.TYPE): Promise; + expandIds(ids: OdbExpandId, count: number): number; +} diff --git a/types/oid-array.d.ts b/types/oid-array.d.ts new file mode 100644 index 000000000..7a96f24a7 --- /dev/null +++ b/types/oid-array.d.ts @@ -0,0 +1,7 @@ +import { Oid } from './oid'; + +export class Oidarray { + free(): void; + ids: Oid; + count: number; +} diff --git a/types/oid.d.ts b/types/oid.d.ts new file mode 100644 index 000000000..2aa65905f --- /dev/null +++ b/types/oid.d.ts @@ -0,0 +1,11 @@ +export class Oid { + static fromString(str: string): Oid; + cmp(b: Oid): number; + cpy(): Oid; + equal(b: Oid): number; + iszero(): number; + ncmp(b: Oid, len: number): number; + strcmp(str: string): number; + streq(str: string): number; + tostrS(): string; +} diff --git a/types/open-ssl.d.ts b/types/open-ssl.d.ts new file mode 100644 index 000000000..f8370260d --- /dev/null +++ b/types/open-ssl.d.ts @@ -0,0 +1,3 @@ +export class Openssl { + static setLocking(): number; +} diff --git a/types/pack-builder.d.ts b/types/pack-builder.d.ts new file mode 100644 index 000000000..ed0fa0a2c --- /dev/null +++ b/types/pack-builder.d.ts @@ -0,0 +1,25 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Revwalk } from './rev-walk'; + +export namespace Packbuilder { + const enum STAGE { + ADDING_OBJECTS = 0, + DELTAFICATION = 1 + } +} + +export class Packbuilder { + static create(repo: Repository): Packbuilder; + + free(): void; + hash(): Oid; + insert(id: Oid, name: string): number; + insertCommit(id: Oid): number; + insertRecur(id: Oid, name: string): number; + insertTree(id: Oid): number; + insertWalk(walk: Revwalk): number; + objectCount(): number; + setThreads(n: number): number; + written(): number; +} diff --git a/types/package.json b/types/package.json new file mode 100644 index 000000000..4f9ecd863 --- /dev/null +++ b/types/package.json @@ -0,0 +1,30 @@ +{ + "name": "@types/nodegit", + "version": "0.22.7", + "description": "TypeScript definitions for nodegit", + "license": "MIT", + "contributors": [ + { + "name": "Dolan Miu", + "url": "https://github.com/dolanmiu", + "githubUsername": "dolanmiu" + }, + { + "name": "Tobias Nießen", + "url": "https://github.com/tniessen", + "githubUsername": "tniessen" + } + ], + "main": "", + "types": "index", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git" + }, + "scripts": {}, + "dependencies": { + "@types/node": "*" + }, + "typesPublisherContentHash": "d5b49b23427bb03b48c43f48ad51949ac62772598e7bb1bf3311b84d200b412e", + "typeScriptVersion": "2.0" +} \ No newline at end of file diff --git a/types/path-spec.d.ts b/types/path-spec.d.ts new file mode 100644 index 000000000..31b58f014 --- /dev/null +++ b/types/path-spec.d.ts @@ -0,0 +1,34 @@ +import { DiffDelta } from './diff-delta'; +import { Tree } from './tree'; +import { Diff } from './diff'; +import { Repository } from './repository'; +import { Index } from './index'; +import { Strarray } from './str-array'; + +export namespace Pathspec { + const enum FLAG { + DEFAULT = 0, + IGNORE_CASE = 1, + USE_CASE = 2, + NO_GLOB = 4, + NO_MATCH_ERROR = 8, + FIND_FAILURES = 16, + FAILURES_ONLY = 32 + } +} + +export class Pathspec { + static matchListDiffEntry(m: any, pos: number): DiffDelta; + static matchListEntry(m: any, pos: number): string; + static matchListEntrycount(m: any): number; + static matchListFailedEntry(m: any, pos: number): string; + static matchListFailedEntrycount(m: any): number; + static create(pathspec: Strarray | string | string[]): Pathspec; + + free(): void; + matchDiff(diff: Diff, flags: number): Promise; + matchIndex(index: Index, flags: number): Promise; + matchTree(tree: Tree, flags: number): Promise; + matchWorkdir(repo: Repository, flags: number): Promise; + matchesPath(flags: number, path: string): number; +} diff --git a/types/proxy-options.d.ts b/types/proxy-options.d.ts new file mode 100644 index 000000000..88f734833 --- /dev/null +++ b/types/proxy-options.d.ts @@ -0,0 +1,9 @@ +export class ProxyOptions { + certificateCheck?: Function; + credentials?: Function; + payload?: any; + type?: number; + url?: string; + version?: number; + [key: string]: any; +} diff --git a/types/proxy.d.ts b/types/proxy.d.ts new file mode 100644 index 000000000..8b4806a2e --- /dev/null +++ b/types/proxy.d.ts @@ -0,0 +1,5 @@ +import { ProxyOptions } from './proxy-options'; + +export class Proxy { + static initOptions(opts: ProxyOptions, version: number): number; +} diff --git a/types/push-options.d.ts b/types/push-options.d.ts new file mode 100644 index 000000000..5f7625db2 --- /dev/null +++ b/types/push-options.d.ts @@ -0,0 +1,12 @@ +import { RemoteCallbacks } from './remote-callbacks'; +import { Strarray } from './str-array'; +import { ProxyOptions } from './proxy-options'; + +export interface PushOptions { + version?: number; + pbParallelism?: number; + callbacks?: RemoteCallbacks; + customHeaders?: Strarray | string | string[]; + proxyOpts?: ProxyOptions; + [key: string]: any; +} diff --git a/types/push-update.d.ts b/types/push-update.d.ts new file mode 100644 index 000000000..50f46726d --- /dev/null +++ b/types/push-update.d.ts @@ -0,0 +1,8 @@ +import { Oid } from './oid'; + +export class PushUpdate { + srcRefname: string; + dstRefname: string; + src: Oid; + dst: Oid; +} diff --git a/types/push.d.ts b/types/push.d.ts new file mode 100644 index 000000000..26d8f07b6 --- /dev/null +++ b/types/push.d.ts @@ -0,0 +1,6 @@ +import { RemoteCallbacks } from './remote-callbacks'; +import { PushOptions } from './push-options'; + +export class Push { + static initOptions(opts: PushOptions, version: number): number; +} diff --git a/types/rebase-operation.d.ts b/types/rebase-operation.d.ts new file mode 100644 index 000000000..7144ebe6a --- /dev/null +++ b/types/rebase-operation.d.ts @@ -0,0 +1,18 @@ +import { Oid } from './oid'; + +export namespace RebaseOperation { + const enum REBASE_OPERATION { + PICK = 0, + REWORD = 1, + EDIT = 2, + SQUASH = 3, + FIXUP = 4, + EXEC = 5 + } +} + +export class RebaseOperation { + type: number; + id: Oid; + exec: string; +} diff --git a/types/rebase.d.ts b/types/rebase.d.ts new file mode 100644 index 000000000..be0b5d2c9 --- /dev/null +++ b/types/rebase.d.ts @@ -0,0 +1,29 @@ +import { CheckoutOptions } from './checkout-options'; +import { AnnotatedCommit } from './annotated-commit'; +import { Repository } from './repository'; +import { Signature } from './signature'; +import { Oid } from './oid'; +import { RebaseOperation } from './rebase-operation'; +import { Index } from './index'; + +export interface RebaseOptions { + version: number; + quiet: number; + rewriteNotesRef: string; + checkoutOptions: CheckoutOptions; +} + +export class Rebase { + static init(repo: Repository, branch: AnnotatedCommit, upstream: AnnotatedCommit, onto: AnnotatedCommit, opts?: RebaseOptions): Promise; + static initOptions(opts: RebaseOptions, version: number): number; + static open(repo: Repository, opts?: RebaseOptions): Promise; + + abort(): number; + commit(author: Signature, committer: Signature, messageEncoding: string, message: string): Oid; + finish(signature: Signature): number; + inmemoryIndex(index: Index): number; + next(): Promise; + operationByIndex(idx: number): RebaseOperation; + operationCurrent(): number; + operationEntrycount(): number; +} diff --git a/types/ref-db.d.ts b/types/ref-db.d.ts new file mode 100644 index 000000000..6a5701ff0 --- /dev/null +++ b/types/ref-db.d.ts @@ -0,0 +1,9 @@ +import { Repository } from './repository'; + +export class Refdb { + static open(repo: Repository): Promise; + + compress(): number; + + free(): void; +} diff --git a/types/ref-log.d.ts b/types/ref-log.d.ts new file mode 100644 index 000000000..ac43de7e7 --- /dev/null +++ b/types/ref-log.d.ts @@ -0,0 +1,24 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Signature } from './signature'; + +export class Reflog { + static delete(repo: Repository, name: string): number; + static read(repo: Repository, name: string): Promise; + static rename(repo: Repository, oldName: string, name: string): number; + + append(id: Oid, committer: Signature, msg: string): number; + drop(idx: number, rewritePreviousEntry: number): number; + entryByIndex(idx: number): ReflogEntry; + entrycount(): number; + + free(): void; + write(): number; +} + +export class ReflogEntry { + committer(): Signature; + idNew(): Oid; + idOld(): Oid; + message(): string; +} diff --git a/types/ref-spec.d.ts b/types/ref-spec.d.ts new file mode 100644 index 000000000..bf40f21ac --- /dev/null +++ b/types/ref-spec.d.ts @@ -0,0 +1,8 @@ +export class Refspec { + direction(): number; + dst(): string; + dstMatches(refname: string): number; + force(): number; + src(): string; + srcMatches(refname: string): number; +} diff --git a/types/reference.d.ts b/types/reference.d.ts new file mode 100644 index 000000000..cc6cb90e2 --- /dev/null +++ b/types/reference.d.ts @@ -0,0 +1,60 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Object } from './object'; + +export namespace Reference { + const enum TYPE { + INVALID = 0, + OID = 1, + SYMBOLIC = 2, + LISTALL = 3 + } + + const enum NORMALIZE { + REF_FORMAT_NORMAL = 0, + REF_FORMAT_ALLOW_ONELEVEL = 1, + REF_FORMAT_REFSPEC_PATTERN = 2, + REF_FORMAT_REFSPEC_SHORTHAND = 4 + } +} + +export class Reference { + static create(repo: Repository, name: string, id: Oid, force: number, logMessage: string): Promise; + static createMatching(repo: Repository, name: string, id: Oid, force: number, currentId: Oid, logMessage: string): Promise; + static dwim(repo: Repository, id: string | Reference, callback?: Function): Promise; + static ensureLog(repo: Repository, refname: string): number; + static hasLog(repo: Repository, refname: string): number; + static isValidName(refname: string): number; + static list(repo: Repository): Promise; + static lookup(repo: Repository, id: string | Reference, callback?: Function): Promise; + static nameToId(repo: Repository, name: string): Promise; + static normalizeName(bufferOut: string, bufferSize: number, name: string, flags: number): number; + static remove(repo: Repository, name: string): number; + static symbolicCreate(repo: Repository, name: string, target: string, force: number, logMessage: string): Promise; + static symbolicCreateMatching(repo: Repository, name: string, target: string, force: number, currentValue: string, logMessage: string): Promise; + + cmp(ref2: Reference): number; + delete(): number; + isBranch(): number; + isNote(): number; + isRemote(): number; + isTag(): number; + name(): string; + owner(): Repository; + peel(type: Object.TYPE): Promise; + rename(newName: string, force: number, logMessage: string): Promise; + resolve(): Promise; + setTarget(id: Oid, logMessage: string): Promise; + shorthand(): string; + symbolicSetTarget(target: string, logMessage: string): Promise; + symbolicTarget(): string; + target(): Oid; + targetPeel(): Oid; + type(): number; + isValid(): boolean; + isConcrete(): boolean; + isSymbolic(): boolean; + toString(): string; + isHead(): boolean; + dup(): Promise; +} diff --git a/types/remote-callbacks.d.ts b/types/remote-callbacks.d.ts new file mode 100644 index 000000000..ca244e5c5 --- /dev/null +++ b/types/remote-callbacks.d.ts @@ -0,0 +1,8 @@ +export class RemoteCallbacks { + version?: number; + credentials?: Function; + certificateCheck?: Function; + transferProgress?: Function; + transport?: Function; + payload?: undefined; +} diff --git a/types/remote.d.ts b/types/remote.d.ts new file mode 100644 index 000000000..8a77f4ea6 --- /dev/null +++ b/types/remote.d.ts @@ -0,0 +1,71 @@ +import { Repository } from './repository'; +import { RemoteCallbacks } from './remote-callbacks'; +import { Strarray } from './str-array'; +import { FetchOptions } from './fetch-options'; +import { Buf } from './buf'; +import { Enums } from './enums'; +import { TransferProgress } from './transfer-progress'; +import { PushOptions } from './push-options'; +import { Refspec } from './ref-spec'; + +export namespace Remote { + const enum AUTOTAG_OPTION { + DOWNLOAD_TAGS_UNSPECIFIED = 0, + DOWNLOAD_TAGS_AUTO = 1, + DOWNLOAD_TAGS_NONE = 2, + DOWNLOAD_TAGS_ALL = 3 + } + + const enum COMPLETION_TYPE { + COMPLETION_DOWNLOAD = 0, + COMPLETION_INDEXING = 1, + COMPLETION_ERROR = 2 + } +} + +export class Remote { + static addFetch(repo: Repository, remote: string, refspec: string): number; + static addPush(repo: Repository, remote: string, refspec: string): number; + static create(repo: Repository, name: string, url: string): Remote; + static createAnonymous(repo: Repository, url: string): Promise; + static createWithFetchspec(repo: Repository, name: string, url: string, fetch: string): Promise; + static delete(repo: Repository, name: string): Promise; + static initCallbacks(opts: RemoteCallbacks, version: number): number; + static isValidName(remoteName: string): boolean; + static list(repo: Repository): Promise; + static lookup(repo: Repository, name: string | Remote, callback?: Function): Promise; + static setAutotag(repo: Repository, remote: string, value: number): number; + static setPushurl(repo: Repository, remote: string, url: string): number; + static setUrl(repo: Repository, remote: string, url: string): number; + + autotag(): number; + connect(direction: Enums.DIRECTION, callbacks: RemoteCallbacks, callback?: Function): Promise; + connected(): number; + defaultBranch(): Promise; + disconnect(): Promise; + download(refSpecs: any[], opts?: FetchOptions, callback?: Function): Promise; + dup(): Promise; + fetch(refSpecs: any[], opts: FetchOptions, message: string, callback?: Function): Promise; + + free(): void; + getFetchRefspecs(): Promise; + getPushRefspecs(): Promise; + getRefspec(n: number): Refspec; + name(): string; + owner(): Repository; + prune(callbacks: RemoteCallbacks): number; + pruneRefs(): number; + push(refSpecs: any[], options?: PushOptions, callback?: Function): Promise; + pushurl(): string; + refspecCount(): number; + stats(): TransferProgress; + + stop(): void; + updateTips(callbacks: RemoteCallbacks, updateFetchhead: number, downloadTags: number, reflogMessage: string): number; + upload(refspecs: Strarray | string | string[], opts?: PushOptions): number; + url(): string; + /** + * Lists advertised references from a remote. You must connect to the remote before using referenceList. + */ + referenceList(): Promise; +} diff --git a/types/repository.d.ts b/types/repository.d.ts new file mode 100644 index 000000000..6066f770b --- /dev/null +++ b/types/repository.d.ts @@ -0,0 +1,248 @@ +import { Oid } from './oid'; +import { Buf } from './buf'; +import { Reference } from './reference'; +import { Odb } from './odb'; +import { Object } from './object'; +import { Index } from './index_'; +import { Commit } from './commit'; +import { Blob } from './blob'; +import { Tree } from './tree'; +import { Signature } from './signature'; +import { AnnotatedCommit } from './annotated-commit'; +import { FetchOptions } from './fetch-options'; +import { CheckoutOptions } from './checkout-options'; +import { Remote } from './remote'; +import { Tag } from './tag'; +import { Config } from './config'; +import { Merge } from './merge'; +import { MergeOptions } from './merge-options'; +import { Refdb } from './ref-db'; +import { Revwalk } from './rev-walk'; +import { StatusFile } from './status-file'; +import { StatusOptions } from './status-options'; +import { DiffLine } from './diff-line'; +import { Treebuilder } from './tree-builder'; + +export interface RepositoryInitOptions { + description: string; + flags: number; + initialHead: string; + mode: number; + originUrl: string; + templatePath: string; + version: number; + workdirPath: string; +} + +export class Repository { + /** + * Creates a branch with the passed in name pointing to the commit + */ + static discover(startPath: string, acrossFs: number, ceilingDirs: string): Promise; + static init(path: string, isBare: number): Promise; + static initExt(repoPath: string, options?: RepositoryInitOptions): Promise; + static open(path: string): Promise; + static openBare(barePath: string): Promise; + static openExt(path: string, flags?: number, ceilingDirs?: string): Promise; + static wrapOdb(odb: Odb): Promise; + + cleanup(): void; + config(): Promise; + configSnapshot(): Promise; + detachHead(): number; + fetchheadForeach(callback?: Function): Promise; + + free(): void; + getNamespace(): string; + head(): Promise; + headDetached(): number; + headUnborn(): number; + index(): Promise; + isBare(): number; + isEmpty(): number; + isShallow(): number; + mergeheadForeach(callback?: Function): Promise; + messageRemove(): number; + odb(): Promise; + path(): string; + refdb(): Promise; + setHead(refname: string): Promise; + setHeadDetached(commitish: Oid): number; + setHeadDetachedFromAnnotated(commitish: AnnotatedCommit): number; + setIdent(name: string, email: string): number; + setNamespace(nmspace: string): number; + setWorkdir(workdir: string, updateGitLink: number): number; + state(): number; + stateCleanup(): number; + workdir(): string; + /** + * Creates a branch with the passed in name pointing to the commit + */ + createBranch(name: string, commit: Commit | string | Oid, force?: boolean): Promise; + /** + * Look up a refs's commit. + */ + getReferenceCommit(name: string | Reference): Promise; + /** + * Look up a branch. Alias for getReference + */ + getBranch(name: string | Reference): Promise; + /** + * Look up a branch's most recent commit. Alias to getReferenceCommit + */ + getBranchCommit(name: string | Reference): Promise; + /** + * Gets the branch that HEAD currently points to Is an alias to head() + */ + getCurrentBranch(): Promise; + /** + * Lookup the reference with the given name. + */ + getReference(name: string | Reference): Promise; + /** + * Lookup references for a repository. + */ + getReferences(type: Reference.TYPE): Promise; + /** + * Lookup reference names for a repository. + */ + getReferenceNames(type: Reference.TYPE): Promise; + getCommit(string: string | Commit| Oid): Promise; + /** + * Retrieve the blob represented by the oid. + */ + getBlob(string: string | Oid): Promise; + /** + * Retrieve the tree represented by the oid. + */ + getTree(string: string | Oid): Promise; + createTag(string: string | Oid, name: string, message: string): Promise; + /** + * Creates a new lightweight tag + */ + createLightweightTag(string: string | Oid, name: string): Promise; + /** + * Retrieve the tag represented by the oid. + */ + getTag(string: string | Oid): Promise; + /** + * Retrieve the tag represented by the tag name. + */ + getTagByName(Short: string): Promise; + /** + * Deletes a tag from a repository by the tag name. + */ + deleteTagByName(Short: string): Promise; + /** + * Instantiate a new revision walker for browsing the Repository"s history. See also Commit.prototype.history() + */ + createRevWalk(): Revwalk; + /** + * Retrieve the master branch commit. + */ + getMasterCommit(): Promise; + /** + * Retrieve the commit that HEAD is currently pointing to + */ + getHeadCommit(): Promise; + createCommit(updateRef: string, author: Signature, committer: Signature, message: string, Tree: Tree | Oid | string, parents: Array, callback?: Function): Promise; + /** + * Creates a new commit on HEAD from the list of passed in files + */ + createCommitOnHead(filesToAdd: string[], author: Signature, committer: Signature, message: string): Promise; + /** + * Create a blob from a buffer + */ + createBlobFromBuffer(buffer: Buffer): Oid; + treeBuilder(tree: Tree): Promise; + /** + * Gets the default signature for the default user and now timestamp + */ + defaultSignature(): Signature; + /** + * Lists out the remotes in the given repository. + */ + getRemotes(callback?: Function): Promise; + /** + * Gets a remote from the repo + */ + getRemote(remote: string | Remote, callback?: Function): Promise; + /** + * Fetches from a remote + */ + fetch(remote: string | Remote, fetchOptions?: FetchOptions): Promise; + /** + * Fetches from all remotes. This is done in series due to deadlocking issues with fetching from many remotes that can happen. + */ + fetchAll(fetchOptions?: FetchOptions, callback?: Function): Promise; + mergeBranches(to: string | Reference, from: string | Reference, signature?: Signature, mergePreference?: Merge.PREFERENCE, mergeOptions?: MergeOptions): Promise; + /** + * Rebases a branch onto another branch + */ + rebaseBranches(branch: string, upstream: string, onto: string, signature: Signature, beforeNextFn: Function): Promise; + continueRebase(signature: Signature, beforeNextFn: Function): Promise; + /** + * Get the status of a repo to it's working directory + */ + getStatus(opts?: StatusOptions): Promise; + /** + * Get extended statuses of a repo to it's working directory. Status entries have status, headToIndex delta, and indexToWorkdir deltas + */ + getStatusExt(opts?: StatusOptions): Promise; + /** + * Get the names of the submodules in the repository. + */ + getSubmoduleNames(): Promise; + /** + * This will set the HEAD to point to the reference and then attempt to update the index and working tree to match the content of the latest commit on that reference + */ + checkoutRef(reference: Reference, opts?: CheckoutOptions): Promise; + /** + * This will set the HEAD to point to the local branch and then attempt to update the index and working tree to match the content of the latest commit on that branch + */ + checkoutBranch(branch: string | Reference, opts?: CheckoutOptions): Promise; + /** + * Stages or unstages line selection of a specified file + */ + stageFilemode(filePath: string | string[], stageNew: boolean): Promise; + /** + * Stages or unstages line selection of a specified file + */ + stageLines(filePath: string, newLines: DiffLine[], isStaged: boolean): Promise; + /** + * Returns true if the repository is in the default NONE state. + */ + isDefaultState(): boolean; + /** + * Returns true if the repository is in the APPLY_MAILBOX or APPLY_MAILBOX_OR_REBASE state. + */ + isApplyingMailbox(): boolean; + /** + * Returns true if the repository is in the BISECT state. + */ + isBisecting(): boolean; + /** + * Returns true if the repository is in the CHERRYPICK state. + */ + isCherrypicking(): boolean; + /** + * Returns true if the repository is in the MERGE state. + */ + isMerging(): boolean; + /** + * Returns true if the repository is in the REBASE, REBASE_INTERACTIVE, or REBASE_MERGE state. + */ + isRebasing(): boolean; + /** + * Returns true if the repository is in the REVERT state. + */ + isReverting(): boolean; + /** + * Discard line selection of a specified file. Assumes selected lines are unstaged. + */ + discardLines(filePath: string, selectedLines: DiffLine[]): Promise; + /** + * Grabs a fresh copy of the index from the repository. Invalidates all previously grabbed indexes + */ + refreshIndex(): Promise; +} diff --git a/types/reset.d.ts b/types/reset.d.ts new file mode 100644 index 000000000..9051fa693 --- /dev/null +++ b/types/reset.d.ts @@ -0,0 +1,30 @@ +import { AnnotatedCommit } from './annotated-commit'; +import { Repository } from './repository'; +import { Object } from './object'; +import { Strarray } from './str-array'; +import { CheckoutOptions } from './checkout-options'; + +export namespace Reset { + const enum TYPE { + SOFT = 1, + MIXED = 2, + HARD = 3 + } +} + +export class Reset { + /** + * Look up a refs's commit. + */ + static reset(repo: Repository, target: Object, resetType: number, checkoutOpts: CheckoutOptions): Promise; + /** + * Look up a refs's commit. + */ + static default(repo: Repository, target: Object, pathspecs: Strarray | string | string[]): Promise; + /** + * Sets the current head to the specified commit oid and optionally resets the index and working tree to match. + * This behaves like reset but takes an annotated commit, which lets you specify which extended sha syntax string was specified by a user, allowing for more exact reflog messages. + * See the documentation for reset. + */ + static fromAnnotated(repo: Repository, commit: AnnotatedCommit, resetType: number, checkoutOpts: CheckoutOptions): number; +} diff --git a/types/rev-parse.d.ts b/types/rev-parse.d.ts new file mode 100644 index 000000000..c878b791f --- /dev/null +++ b/types/rev-parse.d.ts @@ -0,0 +1,16 @@ +import { Object } from './object'; +import { Repository } from './repository'; +import { Reference } from './reference'; + +export namespace Revparse { + const enum MODE { + SINGLE = 1, + RANGE = 2, + MERGE_BASE = 4 + } +} + +export class Revparse { + static ext(objectOut: Object, referenceOut: Reference, repo: Repository, spec: string): number; + static single(repo: Repository, spec: string): Promise; +} diff --git a/types/rev-walk.d.ts b/types/rev-walk.d.ts new file mode 100644 index 000000000..065c51574 --- /dev/null +++ b/types/rev-walk.d.ts @@ -0,0 +1,47 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Commit } from './commit'; + +export namespace Revwalk { + const enum SORT { + NONE = 0, + TOPOLOGICAL = 1, + TIME = 2, + REVERSE = 4 + } +} + +export class Revwalk { + static create(repo: Repository): Revwalk; + + hide(commitId: Oid): number; + hideGlob(glob: string): number; + hideHead(): number; + hideRef(refname: string): number; + next(): Promise; + push(id: Oid): number; + pushGlob(glob: string): number; + pushHead(): number; + pushRange(range: string): number; + pushRef(refname: string): number; + repository(): Repository; + + reset(): void; + + simplifyFirstParent(): void; + /** + * Set the sort order for the revwalk. This function takes variable arguments like revwalk.sorting(NodeGit.RevWalk.Topological, NodeGit.RevWalk.Reverse). + */ + sorting(sort: number): void; + fastWalk(maxCount: number): Promise; + fileHistoryWalk(filePath: string, maxCount: number): Promise; + /** + * Walk the history from the given oid. The callback is invoked for each commit; When the walk is over, the callback is invoked with (null, null). + */ + walk(oid: Oid, callback?: Function): Commit; + /** + * Walk the history grabbing commits until the checkFn called with the current commit returns false. + */ + getCommitsUntil(checkFn: Function): Promise; + getCommits(count: number): Promise; +} diff --git a/types/revert.d.ts b/types/revert.d.ts new file mode 100644 index 000000000..1f9d4a267 --- /dev/null +++ b/types/revert.d.ts @@ -0,0 +1,21 @@ +import { MergeOptions } from './merge-options'; +import { CheckoutOptions } from './checkout-options'; +import { Repository } from './repository'; +import { Commit } from './commit'; +import { Index } from './index'; + +export interface RevertOptions { + version?: number; + mainline?: number; + mergeOpts?: MergeOptions; + checkoutOpts?: CheckoutOptions; + [key: string]: any; +} + +export class Revert { + static revert(repo: Repository, commit: Commit, givenOpts: RevertOptions): Promise; + /** + * Reverts the given commit against the given "our" commit, producing an index that reflects the result of the revert. + */ + static commit(repo: Repository, revertCommit: Commit, ourCommit: Commit, mainline: number, mergeOptions?: MergeOptions): Promise; +} diff --git a/types/signature.d.ts b/types/signature.d.ts new file mode 100644 index 000000000..93e76fd64 --- /dev/null +++ b/types/signature.d.ts @@ -0,0 +1,17 @@ +import { Repository } from './repository'; +import { Time } from './time'; + +export class Signature { + static default(repo: Repository): Signature; + static create(name: string, email: string, time: number, offset: number): Signature; + static now(name: string, email: string): Signature; + static fromBuffer(buf: string): Promise; + + dup(): Promise; + + free(): void; + toString(): string; + name(): string; + email(): string; + when(): Time; +} diff --git a/types/stash.d.ts b/types/stash.d.ts new file mode 100644 index 000000000..68d61d0e0 --- /dev/null +++ b/types/stash.d.ts @@ -0,0 +1,46 @@ +import { Repository } from './repository'; +import { Signature } from './signature'; +import { Oid } from './oid'; +import { CheckoutOptions } from './checkout-options'; + +export namespace Stash { + const enum APPLY_FLAGS { + APPLY_DEFAULT = 0, + APPLY_REINSTATE_INDEX = 1 + } + + const enum APPLY_PROGRESS { + NONE = 0, + LOADING_STASH = 1, + ANALYZE_INDEX = 2, + ANALYZE_MODIFIED = 3, + ANALYZE_UNTRACKED = 4, + CHECKOUT_UNTRACKED = 5, + CHECKOUT_MODIFIED = 6, + DONE = 7 + } + + const enum FLAGS { + DEFAULT = 0, + KEEP_INDEX = 1, + INCLUDE_UNTRACKED = 2, + INCLUDE_IGNORED = 4 + } +} + +export interface StashApplyOptions { + version?: number; + flags?: number; + checkoutOptions?: CheckoutOptions; + progressCb?: Function; + progressPayload?: any; +} + +export class Stash { + static apply(repo: Repository, index: number, options?: StashApplyOptions): Promise; + static applyInitOptions(opts: StashApplyOptions, version: number): number; + static drop(repo: Repository, index: number): Promise; + static foreach(repo: Repository, callback?: Function): Promise; + static pop(repo: Repository, index: number, options?: StashApplyOptions): Promise; + static save(repo: Repository, stasher: Signature, message: string, flags: number): Promise; +} diff --git a/types/status-entry.d.ts b/types/status-entry.d.ts new file mode 100644 index 000000000..59de1a976 --- /dev/null +++ b/types/status-entry.d.ts @@ -0,0 +1,7 @@ +import { DiffDelta } from './diff-delta'; + +export class StatusEntry { + status(): number; + headToIndex(): DiffDelta; + indexToWorkdir(): DiffDelta; +} diff --git a/types/status-file-options.d.ts b/types/status-file-options.d.ts new file mode 100644 index 000000000..e3852cf0e --- /dev/null +++ b/types/status-file-options.d.ts @@ -0,0 +1,8 @@ +import { StatusEntry } from './status-entry'; + +export interface StatusFileOptions { + path?: string; + status?: number; + entry?: StatusEntry; + [key: string]: any; +} diff --git a/types/status-file.d.ts b/types/status-file.d.ts new file mode 100644 index 000000000..b34a0f234 --- /dev/null +++ b/types/status-file.d.ts @@ -0,0 +1,20 @@ +import { DiffDelta } from './diff-delta'; +import { StatusFileOptions } from './status-file-options'; + +export class StatusFile { + constructor(args: StatusFileOptions); + headToIndex(): DiffDelta; + indexToWorkdir(): DiffDelta; + inIndex(): boolean; + inWorkingTree(): boolean; + isConflicted(): boolean; + isDeleted(): boolean; + isIgnored(): boolean; + isModified(): boolean; + isNew(): boolean; + isRenamed(): boolean; + isTypechange(): boolean; + path(): string; + status(): string[]; + statusBit(): number; +} diff --git a/types/status-list.d.ts b/types/status-list.d.ts new file mode 100644 index 000000000..1b470ceb7 --- /dev/null +++ b/types/status-list.d.ts @@ -0,0 +1,12 @@ +import { Repository } from './repository'; +import { DiffPerfdata } from './diff-perf-data'; +import { StatusOptions } from './status-options'; + +export class StatusList { + static create(repo: Repository, opts?: StatusOptions): Promise; + + entrycount(): number; + + free(): void; + getPerfdata(): Promise; +} diff --git a/types/status-options.d.ts b/types/status-options.d.ts new file mode 100644 index 000000000..f0189706b --- /dev/null +++ b/types/status-options.d.ts @@ -0,0 +1,9 @@ +import { Strarray } from './str-array'; + +export interface StatusOptions { + version?: number; + show?: number; + flags?: number; + pathspec?: Strarray | string | string[]; + [key: string]: any; +} diff --git a/types/status.d.ts b/types/status.d.ts new file mode 100644 index 000000000..5b657d1cc --- /dev/null +++ b/types/status.d.ts @@ -0,0 +1,56 @@ +import { Repository } from './repository'; +import { StatusList } from './status-list'; +import { StatusOptions } from './status-options'; +import { StatusEntry } from './status-entry'; + +export namespace Status { + const enum STATUS { + CURRENT = 0, + INDEX_NEW = 1, + INDEX_MODIFIED = 2, + INDEX_DELETED = 4, + INDEX_RENAMED = 8, + INDEX_TYPECHANGE = 16, + WT_NEW = 128, + WT_MODIFIED = 256, + WT_DELETED = 512, + WT_TYPECHANGE = 1024, + WT_RENAMED = 2048, + WT_UNREADABLE = 4096, + IGNORED = 16384, + CONFLICTED = 32768 + } + + const enum OPT { + INCLUDE_UNTRACKED = 1, + INCLUDE_IGNORED = 2, + INCLUDE_UNMODIFIED = 4, + EXCLUDE_SUBMODULES = 8, + RECURSE_UNTRACKED_DIRS = 16, + DISABLE_PATHSPEC_MATCH = 32, + RECURSE_IGNORED_DIRS = 64, + RENAMES_HEAD_TO_INDEX = 128, + RENAMES_INDEX_TO_WORKDIR = 256, + SORT_CASE_SENSITIVELY = 512, + SORT_CASE_INSENSITIVELY = 1024, + RENAMES_FROM_REWRITES = 2048, + NO_REFRESH = 4096, + UPDATE_INDEX = 8192, + INCLUDE_UNREADABLE = 16384, + INCLUDE_UNREADABLE_AS_UNTRACKED = 32768 + } + + const enum SHOW { + INDEX_AND_WORKDIR = 0, + INDEX_ONLY = 1, + WORKDIR_ONLY = 2 + } +} + +export class Status { + static byIndex(statuslist: StatusList, idx: number): StatusEntry; + static file(repo: Repository, path: string): number; + static foreach(repo: Repository, callback?: Function): Promise; + static foreachExt(repo: Repository, opts?: StatusOptions, callback?: Function): Promise; + static shouldIgnore(ignored: number, repo: Repository, path: string): number; +} diff --git a/types/str-array.d.ts b/types/str-array.d.ts new file mode 100644 index 000000000..44f5914be --- /dev/null +++ b/types/str-array.d.ts @@ -0,0 +1,7 @@ +export class Strarray { + copy(src: Strarray): number; + + free(): void; + strings: string[]; + count: number; +} diff --git a/types/submodule-update-options.d.ts b/types/submodule-update-options.d.ts new file mode 100644 index 000000000..5be827b36 --- /dev/null +++ b/types/submodule-update-options.d.ts @@ -0,0 +1,10 @@ +import { CheckoutOptions } from './checkout-options'; +import { FetchOptions } from './fetch-options'; + +export interface SubmoduleUpdateOptions { + version?: number; + checkoutOpts?: CheckoutOptions; + fetchOpts?: FetchOptions; + cloneCheckoutStrategy?: number; + [key: string]: any; +} diff --git a/types/submodule.d.ts b/types/submodule.d.ts new file mode 100644 index 000000000..4ac5ce3ac --- /dev/null +++ b/types/submodule.d.ts @@ -0,0 +1,87 @@ +import { Repository } from './repository'; +import { Buf } from './buf'; +import { Oid } from './oid'; +import { SubmoduleUpdateOptions } from './submodule-update-options'; + +export namespace Submodule { + const enum IGNORE { + UNSPECIFIED = -1, + NONE = 1, + UNTRACKED = 2, + DIRTY = 3, + ALL = 4 + } + + const enum RECURSE { + NO = 0, + YES = 1, + ONDEMAND = 2 + } + + const enum STATUS { + IN_HEAD = 1, + IN_INDEX = 2, + IN_CONFIG = 4, + IN_WD = 8, + INDEX_ADDED = 16, + INDEX_DELETED = 32, + INDEX_MODIFIED = 64, + WD_UNINITIALIZED = 128, + WD_ADDED = 256, + WD_DELETED = 512, + WD_MODIFIED = 1024, + WD_INDEX_MODIFIED = 2048, + WD_WD_MODIFIED = 4096, + WD_UNTRACKED = 8192 + } + + const enum UPDATE { + CHECKOUT = 1, + REBASE = 2, + MERGE = 3, + NONE = 4, + DEFAULT = 0 + } +} + +export class Submodule { + static addSetup(repo: Repository, url: string, path: string, useGitLink: number): Promise; + static foreach(repo: Repository, callback?: Function): Promise; + static lookup(repo: Repository, name: string): Promise; + static resolveUrl(repo: Repository, url: string): Promise; + static setBranch(repo: Repository, name: string, branch: string): number; + static setFetchRecurseSubmodules(repo: Repository, name: string, fetchRecurseSubmodules: number): number; + static setIgnore(repo: Repository, name: string, ignore: number): Promise; + static setUpdate(repo: Repository, name: string, update: number): Promise; + static setUrl(repo: Repository, name: string, url: string): Promise; + static status(repo: Repository, name: string, ignore: number): Promise; + static updateInitOptions(opts: SubmoduleUpdateOptions, version: number): number; + + addFinalize(): Promise; + addToIndex(writeIndex: number): Promise; + branch(): string; + fetchRecurseSubmodules(): number; + + free(): void; + headId(): Oid; + ignore(): number; + indexId(): Oid; + init(overwrite: number): Promise; + location(): Promise; + name(): string; + open(): Promise; + owner(): Repository; + path(): string; + reload(force: number): number; + repoInit(useGitLink: number): Promise; + sync(): Promise; + /** + * Updates a submodule + * + * + */ + update(init: number, options?: SubmoduleUpdateOptions): Promise; + updateStrategy(): number; + url(): string; + wdId(): Oid; +} diff --git a/types/tag.d.ts b/types/tag.d.ts new file mode 100644 index 000000000..08d25859d --- /dev/null +++ b/types/tag.d.ts @@ -0,0 +1,34 @@ +import { Repository } from './repository'; +import { Oid } from './oid'; +import { Object } from './object'; +import { Signature } from './signature'; +import { Strarray } from './str-array'; + +export class Tag { + static annotationCreate(repo: Repository, tagName: string, target: Object, tagger: Signature, message: string): Promise; + static create(repo: Repository, tagName: string, target: Object, tagger: Signature, message: string, force: number): Promise; + static createLightweight(repo: Repository, tagName: string, target: Object, force: number): Promise; + static delete(repo: Repository, tagName: string): Promise; + static list(repo: Repository): Promise; + static listMatch(tagNames: Strarray | string | string[], pattern: string, repo: Repository): number; + /** + * Retrieves the tag pointed to by the oid + * + * + */ + static lookup(repo: Repository, id: string | Oid | Tag): Promise; + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + + dup(): Promise; + + free(): void; + id(): Oid; + message(): string; + name(): string; + owner(): Repository; + peel(tagTargetOut: Object): number; + tagger(): Signature; + target(): Object; + targetId(): Oid; + targetType(): number; +} diff --git a/types/time.d.ts b/types/time.d.ts new file mode 100644 index 000000000..575c00578 --- /dev/null +++ b/types/time.d.ts @@ -0,0 +1,4 @@ +export class Time { + time: number; + offset: number; +} diff --git a/types/transfer-progress.d.ts b/types/transfer-progress.d.ts new file mode 100644 index 000000000..1589d4b6c --- /dev/null +++ b/types/transfer-progress.d.ts @@ -0,0 +1,9 @@ +export class TransferProgress { + totalObjects: number; + indexedObjects: number; + receivedObjects: number; + localObjects: number; + totalDeltas: number; + indexedDeltas: number; + receivedBytes: number; +} diff --git a/types/transport.d.ts b/types/transport.d.ts new file mode 100644 index 000000000..f4f472133 --- /dev/null +++ b/types/transport.d.ts @@ -0,0 +1,16 @@ +import { Remote } from './remote'; +import { Strarray } from './str-array'; +import { Cert } from './cert'; + +export namespace Transport { + const enum FLAGS { + NONE = 0 + } +} + +export class Transport { + static sshWithPaths(owner: Remote, payload: Strarray | string | string[]): Promise; + static unregister(prefix: string): number; + init(version: number): number; + smartCertificateCheck(cert: Cert, valid: number, hostName: string): number; +} diff --git a/types/tree-builder.d.ts b/types/tree-builder.d.ts new file mode 100644 index 000000000..f5a671549 --- /dev/null +++ b/types/tree-builder.d.ts @@ -0,0 +1,15 @@ +import { Oid } from './oid'; +import { Repository } from './repository'; +import { Tree } from './tree'; +import { TreeEntry } from './tree-entry'; + +export class Treebuilder { + static create(repo: Repository, source: Tree): Promise; + clear(): void; + entrycount(): number; + free(): void; + get(filename: string): TreeEntry; + insert(filename: string, id: Oid, filemode: number): Promise; + remove(filename: string): number; + write(): Oid; +} diff --git a/types/tree-entry.d.ts b/types/tree-entry.d.ts new file mode 100644 index 000000000..a5e68a608 --- /dev/null +++ b/types/tree-entry.d.ts @@ -0,0 +1,48 @@ +import { Tree } from './tree'; +import { Oid } from './oid'; +import { Blob } from './blob'; +import { Repository } from './repository'; + +export namespace TreeEntry { + const enum FILEMODE { + UNREADABLE = 0, + TREE = 16384, + BLOB = 33188, + EXECUTABLE = 33261, + LINK = 40960, + COMMIT = 57344 + } +} + +export class TreeEntry { + filemode(): TreeEntry.FILEMODE; + filemodeRaw(): TreeEntry.FILEMODE; + free(): void; + getBlob(): Promise; + getTree(): Promise; + id(): Oid; + isBlob(): boolean; + isFile(): boolean; + isTree(): boolean; + isDirectory(): boolean; + isSubmodule(): boolean; + /** + * Retrieve the SHA for this TreeEntry. + */ + sha(): string; + name(): string; + /** + * Retrieve the SHA for this TreeEntry. Alias for sha + */ + oid(): string; + /** + * Returns the path for this entry. + */ + path(): string; + /** + * Alias for path + */ + toString(): string; + toObject(repo: Repository): Object; + type(): number; +} diff --git a/types/tree-update.d.ts b/types/tree-update.d.ts new file mode 100644 index 000000000..fde63d064 --- /dev/null +++ b/types/tree-update.d.ts @@ -0,0 +1,8 @@ +import { Oid } from './oid'; + +export class TreeUpdate { + action: number; + filemode: number; + id: Oid; + path: string; +} diff --git a/types/tree.d.ts b/types/tree.d.ts new file mode 100644 index 000000000..50c29e8a3 --- /dev/null +++ b/types/tree.d.ts @@ -0,0 +1,74 @@ +import { Oid } from './oid'; +import { TreeEntry } from './tree-entry'; +import { Repository } from './repository'; +import { Object } from './object'; +import { Treebuilder } from './tree-builder'; +import { DiffFile } from './diff-file'; +import { TreeUpdate } from './tree-update'; + +export namespace Tree { + const enum WALK_MODE { + WALK_PRE = 0, + WALK_POST = 1 + } +} + +export class Tree { + static entryCmp(tree1: TreeEntry, tree2: TreeEntry): number; + static entryDup(dest: TreeEntry, source: TreeEntry): number; + static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; + /** + * Retrieves the tree pointed to by the oid + */ + static lookup(repo: Repository, id: string | Oid | Tree, callback?: Function): Promise; + + entryById(id: Oid): TreeEntry; + _entryByIndex(idx: number): TreeEntry; + /** + * Get an entry by name; if the tree is a directory, the name is the filename. + */ + entryByName(name: string): TreeEntry; + _entryByName(filename: string): TreeEntry; + entryByPath(path: string): Promise; + entryCount(): number; + + free(): void; + id(): Oid; + owner(): Repository; + /** + * Diff two trees + */ + diff(tree: Tree, callback?: Function): Promise; + /** + * Diff two trees with options + */ + diffWithOptions(tree: Tree, options?: Object, callback?: Function): Promise; + /** + * Get an entry at the ith position. + */ + entryByIndex(i: number): TreeEntry; + /** + * Get an entry at a path. Unlike by name, this takes a fully qualified path, like /foo/bar/baz.javascript + */ + getEntry(filePath: string): TreeEntry; + /** + * Return an array of the entries in this tree (excluding its children). + */ + entries(): TreeEntry[]; + /** + * Recursively walk the tree in breadth-first order. Fires an event for each entry. + */ + walk(blobsOnly?: boolean): NodeJS.EventEmitter; + /** + * Return the path of this tree, like /lib/foo/bar + * + * + */ + path(): string; + /** + * Make builder. This is helpful for modifying trees. + */ + builder(): Treebuilder; + dup(): Promise; + createUpdated(repo: Repository, nUpdates: number, updates: TreeUpdate): Promise; +} From 6286b15ccfb09ae26f59ddcc62fb9f683dc845e9 Mon Sep 17 00:00:00 2001 From: Yulong Date: Wed, 27 Mar 2019 15:14:41 +0800 Subject: [PATCH 06/22] added a max_result parameter for fileHistoryWalk (#25) added a max_result parameter for fileHistoryWalk --- .travis.yml | 2 -- generate/input/libgit2-supplement.json | 5 +++++ .../manual/revwalk/file_history_walk.cc | 19 ++++++++++++++----- lib/revwalk.js | 1 + package-lock.json | 14 +++++++++++--- package.json | 15 +++++++-------- test/tests/revwalk.js | 14 ++++++++------ types/rev-walk.d.ts | 2 +- 8 files changed, 47 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index f921535ae..4773206f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,8 +22,6 @@ env: node_js: - "10" - - "8" - - "6" os: - linux diff --git a/generate/input/libgit2-supplement.json b/generate/input/libgit2-supplement.json index 7b19afba9..f0a3bf327 100644 --- a/generate/input/libgit2-supplement.json +++ b/generate/input/libgit2-supplement.json @@ -318,10 +318,15 @@ "name": "file_path", "type": "const char *" }, + { + "name": "max_result", + "type": "int" + }, { "name": "max_count", "type": "int" }, + { "name": "out", "type": "std::vector< std::pair > *> *" diff --git a/generate/templates/manual/revwalk/file_history_walk.cc b/generate/templates/manual/revwalk/file_history_walk.cc index c70b6856c..cd047eef6 100644 --- a/generate/templates/manual/revwalk/file_history_walk.cc +++ b/generate/templates/manual/revwalk/file_history_walk.cc @@ -5,10 +5,14 @@ NAN_METHOD(GitRevwalk::FileHistoryWalk) } if (info.Length() == 1 || !info[1]->IsNumber()) { - return Nan::ThrowError("Max count is required and must be a number."); + return Nan::ThrowError("Max result is required and must be a number."); } - if (info.Length() == 2 || !info[2]->IsFunction()) { + if (info.Length() == 2 || !info[2]->IsNumber()) { + return Nan::ThrowError("Max count is required and must be a number."); + } + + if (info.Length() == 3 || !info[3]->IsFunction()) { return Nan::ThrowError("Callback is required and must be a Function."); } @@ -18,12 +22,13 @@ NAN_METHOD(GitRevwalk::FileHistoryWalk) baton->error = NULL; String::Utf8Value from_js_file_path(info[0]->ToString()); baton->file_path = strdup(*from_js_file_path); - baton->max_count = Nan::To(info[1]).FromJust(); + baton->max_result = Nan::To(info[1]).FromJust(); + baton->max_count = Nan::To(info[2]).FromJust(); baton->out = new std::vector< std::pair > *>; - baton->out->reserve(baton->max_count); + baton->out->reserve(baton->max_result > 0 ? baton->max_result : baton->max_count); baton->walk = Nan::ObjectWrap::Unwrap(info.This())->GetValue(); - Nan::Callback *callback = new Nan::Callback(Local::Cast(info[2])); + Nan::Callback *callback = new Nan::Callback(Local::Cast(info[3])); FileHistoryWalkWorker *worker = new FileHistoryWalkWorker(baton, callback); worker->SaveToPersistent("fileHistoryWalk", info.This()); @@ -227,6 +232,10 @@ void GitRevwalk::FileHistoryWalkWorker::Execute() if (baton->error_code != GIT_OK) { break; } + + if (baton->max_result >=0 && baton->out->size() >= baton->max_result) { + break; + } } free(nextOid); diff --git a/lib/revwalk.js b/lib/revwalk.js index a12d9f7f4..fa685e61f 100644 --- a/lib/revwalk.js +++ b/lib/revwalk.js @@ -20,6 +20,7 @@ var _sorting = Revwalk.prototype.sorting; var fileHistoryWalk = Revwalk.prototype.fileHistoryWalk; /** * @param {String} filePath + * @param {Number} max_result * @param {Number} max_count * @async * @return {Array} diff --git a/package-lock.json b/package-lock.json index 04dff435c..c1d70a402 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "nodegit", + "name": "@elastic/nodegit", "version": "0.25.0-alpha.9", "lockfileVersion": 1, "requires": true, @@ -2586,6 +2586,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz", "integrity": "sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==", + "dev": true, "requires": { "async": "^2.5.0", "optimist": "^0.6.1", @@ -2597,6 +2598,7 @@ "version": "2.6.2", "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "dev": true, "requires": { "lodash": "^4.17.11" } @@ -2604,7 +2606,8 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, @@ -3878,6 +3881,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, "requires": { "minimist": "~0.0.1", "wordwrap": "~0.0.2" @@ -3886,7 +3890,8 @@ "wordwrap": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true } } }, @@ -5307,6 +5312,7 @@ "version": "3.4.9", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", + "dev": true, "optional": true, "requires": { "commander": "~2.17.1", @@ -5317,12 +5323,14 @@ "version": "2.17.1", "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", + "dev": true, "optional": true }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, "optional": true } } diff --git a/package.json b/package.json index 9b4ebd61c..875a5f8af 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.9", + "version": "0.25.0-alpha.10", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", @@ -33,23 +33,22 @@ "promisify-node": "~0.3.0", "ramda": "^0.25.0", "request-promise-native": "^1.0.5", - "tar-fs": "^1.16.3", - "walk": "^2.3.9", - "babel-cli": "^6.7.7", - "babel-preset-es2015": "^6.6.0", - "combyne": "~0.8.1", - "js-beautify": "~1.5.10" + "tar-fs": "^1.16.3" }, "devDependencies": { "aws-sdk": "^2.326.0", + "babel-cli": "^6.7.7", + "babel-preset-es2015": "^6.6.0", "cheerio": "^1.0.0-rc.2", "clean-for-publish": "~1.0.2", "combyne": "~0.8.1", "coveralls": "^3.0.2", "istanbul": "^0.4.5", + "js-beautify": "~1.5.10", "jshint": "^2.9.6", "lcov-result-merger": "^3.1.0", - "mocha": "^5.2.0" + "mocha": "^5.2.0", + "walk": "^2.3.9" }, "vendorDependencies": { "libssh2": "1.8.0", diff --git a/test/tests/revwalk.js b/test/tests/revwalk.js index 6c5865193..c2a1eaf3c 100644 --- a/test/tests/revwalk.js +++ b/test/tests/revwalk.js @@ -169,7 +169,8 @@ describe("Revwalk", function() { "1273fff13b3c28cfdb13ba7f575d696d2a8902e1" ]; - return test.walker.fileHistoryWalk("include/functions/copy.h", 1000) + return test.walker + .fileHistoryWalk("include/functions/copy.h", magicShas.length, 1000) .then(function(results) { var shas = results.map(function(result) { return result.commit.sha(); @@ -199,7 +200,8 @@ describe("Revwalk", function() { "01d469416b26340ee4922d5171ef8dbe46c879f4" ]; - return test.walker.fileHistoryWalk("include/functions", 1000) + return test.walker + .fileHistoryWalk("include/functions", magicShas.length, 1000) .then(function(results) { var shas = results.map(function(result) { return result.commit.sha(); @@ -223,7 +225,7 @@ describe("Revwalk", function() { walker.sorting(NodeGit.Revwalk.SORT.TIME); walker.push("115d114e2c4d5028c7a78428f16a4528c51be7dd"); - return walker.fileHistoryWalk("README.md", 15) + return walker.fileHistoryWalk("README.md", magicShas.length, 15) .then(function(results) { shas = results.map(function(result) { return result.commit.sha(); @@ -244,7 +246,7 @@ describe("Revwalk", function() { walker.sorting(NodeGit.Revwalk.SORT.TIME); walker.push("d46f7da82969ca6620864d79a55b951be0540bda"); - return walker.fileHistoryWalk("README.md", 50); + return walker.fileHistoryWalk("README.md", magicShas.length, 50); }) .then(function(results) { shas = results.map(function(result) { @@ -317,7 +319,7 @@ describe("Revwalk", function() { var walker = repo.createRevWalk(); walker.sorting(NodeGit.Revwalk.SORT.TIME); walker.push(commitOid.tostrS()); - return walker.fileHistoryWalk(fileNameB, 5); + return walker.fileHistoryWalk(fileNameB, -1,5); }) .then(function(results) { assert.equal(results[0].status, NodeGit.Diff.DELTA.RENAMED); @@ -328,7 +330,7 @@ describe("Revwalk", function() { var walker = repo.createRevWalk(); walker.sorting(NodeGit.Revwalk.SORT.TIME); walker.push(headCommit); - return walker.fileHistoryWalk(fileNameA, 5); + return walker.fileHistoryWalk(fileNameA, -1, 5); }) .then(function(results) { assert.equal(results[0].status, NodeGit.Diff.DELTA.RENAMED); diff --git a/types/rev-walk.d.ts b/types/rev-walk.d.ts index 065c51574..2c7ba67d0 100644 --- a/types/rev-walk.d.ts +++ b/types/rev-walk.d.ts @@ -34,7 +34,7 @@ export class Revwalk { */ sorting(sort: number): void; fastWalk(maxCount: number): Promise; - fileHistoryWalk(filePath: string, maxCount: number): Promise; + fileHistoryWalk(filePath: string, maxResult: number, maxCount: number): Promise; /** * Walk the history from the given oid. The callback is invoked for each commit; When the walk is over, the callback is invoked with (null, null). */ From c5ca3d96ce34e6fc8821e0f2997932f005d03c98 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Wed, 27 Mar 2019 17:43:28 +0800 Subject: [PATCH 07/22] handle DeprecationWarning --- lib/repository.js | 2 +- package.json | 2 +- types/reference.d.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/repository.js b/lib/repository.js index 22f10668f..435e207d1 100644 --- a/lib/repository.js +++ b/lib/repository.js @@ -357,7 +357,7 @@ Repository.getReferences = function(repo, type, refNamesOnly, callback) { refList.forEach(function(refName) { refFilterPromises.push(Reference.lookup(repo, refName) .then(function(ref) { - if (type == Reference.TYPE.LISTALL || ref.type() == type) { + if (type == Reference.TYPE.ALL || ref.type() == type) { if (refNamesOnly) { filteredRefs.push(refName); return; diff --git a/package.json b/package.json index 875a5f8af..127944796 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.10", + "version": "0.25.0-alpha.11", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", diff --git a/types/reference.d.ts b/types/reference.d.ts index cc6cb90e2..a84822a69 100644 --- a/types/reference.d.ts +++ b/types/reference.d.ts @@ -5,9 +5,9 @@ import { Object } from './object'; export namespace Reference { const enum TYPE { INVALID = 0, - OID = 1, + DIRECT = 1, SYMBOLIC = 2, - LISTALL = 3 + ALL = 3 } const enum NORMALIZE { From ccd57bbf47c805f0ff518201c4f708e36c4dc121 Mon Sep 17 00:00:00 2001 From: Yulong Date: Wed, 3 Apr 2019 10:29:04 +0800 Subject: [PATCH 08/22] fix a crash when using ssh on mac (#26) --- generate/templates/templates/binding.gyp | 204 ++++++++++------------- package.json | 2 +- 2 files changed, 93 insertions(+), 113 deletions(-) diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index 48367e20f..7ecdd55e2 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -1,41 +1,14 @@ { - "conditions": [ - ["(OS=='win' and node_root_dir.split('\\\\')[-1].startswith('iojs')) or (OS=='mac' and node_root_dir.split('/')[-1].startswith('iojs'))", { - "conditions": [ - ["OS=='win'", { - "variables": { - "is_electron%": "1", - "openssl_include_dir%": "<(module_root_dir)\\vendor\\openssl" - } - }, { - "variables": { - "is_electron%": "1", - "openssl_include_dir%": "<(module_root_dir)/vendor/openssl" - } - }] - ], - }, { - "conditions": [ - ["OS=='win'", { - "variables": { - "is_electron%": "0", - "openssl_include_dir%": "<(node_root_dir)\\include\\node" - } - }, { - "variables": { - "is_electron%": "0", - "openssl_include_dir%": "<(node_root_dir)/include/node" - } - }] - ] - }] - ], + "variables": { + "is_electron%": " Date: Thu, 25 Apr 2019 05:49:44 -0700 Subject: [PATCH 09/22] Fix binary info's platform passing --- lib/utils/binary_info.js | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/utils/binary_info.js b/lib/utils/binary_info.js index c0ccf60b0..4f20c4616 100644 --- a/lib/utils/binary_info.js +++ b/lib/utils/binary_info.js @@ -7,6 +7,7 @@ function binary_info(platform, arch) { var package_json = JSON.parse( fs.readFileSync(path.resolve(__dirname,"../../package.json"), "utf8")); var options = { + platform, target_platform: platform, target_arch: arch }; diff --git a/package.json b/package.json index 9d925cc32..f9051f9e5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.12", + "version": "0.25.0-alpha.13", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", From 81af3048dba3c5a414d1cb3668136a191830b18d Mon Sep 17 00:00:00 2001 From: Mengwei Ding Date: Mon, 29 Apr 2019 11:17:07 +0800 Subject: [PATCH 10/22] Override the options for Worktree.add --- generate/input/libgit2-supplement.json | 7 + .../templates/manual/worktree/worktree_add.cc | 211 ++++++++++++++++++ package-lock.json | 2 +- test/tests/worktree.js | 49 ++++ 4 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 generate/templates/manual/worktree/worktree_add.cc create mode 100644 test/tests/worktree.js diff --git a/generate/input/libgit2-supplement.json b/generate/input/libgit2-supplement.json index f0a3bf327..c78082956 100644 --- a/generate/input/libgit2-supplement.json +++ b/generate/input/libgit2-supplement.json @@ -107,6 +107,13 @@ "isPrototypeMethod": false, "group": "clone" }, + "git_worktree_add": { + "isManual": true, + "cFile": "generate/templates/manual/worktree/worktree_add.cc", + "isAsync": true, + "isPrototypeMethod": false, + "group": "worktree" + }, "git_commit_extract_signature": { "args": [ { diff --git a/generate/templates/manual/worktree/worktree_add.cc b/generate/templates/manual/worktree/worktree_add.cc new file mode 100644 index 000000000..8277b06f5 --- /dev/null +++ b/generate/templates/manual/worktree/worktree_add.cc @@ -0,0 +1,211 @@ +NAN_METHOD(GitWorktree::Add) { + + if (info.Length() == 0 || !info[0]->IsObject()) { + return Nan::ThrowError("Repository repo is required."); + } + + if (info.Length() == 1 || !info[1]->IsString()) { + return Nan::ThrowError("String name is required."); + } + + if (info.Length() == 2 || !info[2]->IsString()) { + return Nan::ThrowError("String path is required."); + } + + if (info.Length() == 3 || !info[3]->IsObject()) { + return Nan::ThrowError("WorktreeAddOptions opts is required."); + } + + if (info.Length() == 4 || !info[4]->IsFunction()) { + return Nan::ThrowError("Callback is required and must be a Function."); + } + + AddBaton* baton = new AddBaton; + + baton->error_code = GIT_OK; + baton->error = NULL; + +// start convert_from_v8 block + git_repository * from_repo = NULL; +from_repo = Nan::ObjectWrap::Unwrap(info[0]->ToObject())->GetValue(); +// end convert_from_v8 block + baton->repo = from_repo; +// start convert_from_v8 block + const char * from_name = NULL; + + String::Utf8Value name(info[1]->ToString()); + // malloc with one extra byte so we can add the terminating null character C-strings expect: + from_name = (const char *) malloc(name.length() + 1); + // copy the characters from the nodejs string into our C-string (used instead of strdup or strcpy because nulls in + // the middle of strings are valid coming from nodejs): + memcpy((void *)from_name, *name, name.length()); + // ensure the final byte of our new string is null, extra casts added to ensure compatibility with various C types + // used in the nodejs binding generation: + memset((void *)(((char *)from_name) + name.length()), 0, 1); +// end convert_from_v8 block + baton->name = from_name; +// start convert_from_v8 block + const char * from_path = NULL; + + String::Utf8Value path(info[2]->ToString()); + // malloc with one extra byte so we can add the terminating null character C-strings expect: + from_path = (const char *) malloc(path.length() + 1); + // copy the characters from the nodejs string into our C-string (used instead of strdup or strcpy because nulls in + // the middle of strings are valid coming from nodejs): + memcpy((void *)from_path, *path, path.length()); + // ensure the final byte of our new string is null, extra casts added to ensure compatibility with various C types + // used in the nodejs binding generation: + memset((void *)(((char *)from_path) + path.length()), 0, 1); +// end convert_from_v8 block + baton->path = from_path; +// start convert_from_v8 block + // Create a git_worktree_add_options with the default value + const git_worktree_add_options from_opts = {1, 0, NULL}; +// end convert_from_v8 block + baton->opts = &from_opts; + + Nan::Callback *callback = new Nan::Callback(v8::Local::Cast(info[4])); + AddWorker *worker = new AddWorker(baton, callback); + + if (!info[0]->IsUndefined() && !info[0]->IsNull()) + worker->SaveToPersistent("repo", info[0]->ToObject()); + if (!info[1]->IsUndefined() && !info[1]->IsNull()) + worker->SaveToPersistent("name", info[1]->ToObject()); + if (!info[2]->IsUndefined() && !info[2]->IsNull()) + worker->SaveToPersistent("path", info[2]->ToObject()); + if (!info[3]->IsUndefined() && !info[3]->IsNull()) + worker->SaveToPersistent("opts", info[3]->ToObject()); + + AsyncLibgit2QueueWorker(worker); + return; +} + +void GitWorktree::AddWorker::Execute() { + git_error_clear(); + + { + LockMaster lockMaster( + /*asyncAction: */true + ,baton->repo + ,baton->name + ,baton->path + ,baton->opts + ); + + int result = git_worktree_add( +&baton->out,baton->repo,baton->name,baton->path,baton->opts ); + + baton->error_code = result; + + if (result != GIT_OK && git_error_last() != NULL) { + baton->error = git_error_dup(git_error_last()); + } + + } +} + +void GitWorktree::AddWorker::HandleOKCallback() { + if (baton->error_code == GIT_OK) { + v8::Local to; +// start convert_to_v8 block + if (baton->out != NULL) { + v8::Local owners = Nan::New(0); + Nan::Set(owners, Nan::New(owners->Length()), this->GetFromPersistent("repo")->ToObject()); + to = GitWorktree::New( + baton->out, + true + , owners + ); + } + else { + to = Nan::Null(); + } + // end convert_to_v8 block + v8::Local result = to; + + v8::Local argv[2] = { + Nan::Null(), + result + }; + callback->Call(2, argv, async_resource); + } else { + if (baton->error) { + v8::Local err; + if (baton->error->message) { + err = Nan::Error(baton->error->message)->ToObject(); + } else { + err = Nan::Error("Method add has thrown an error.")->ToObject(); + } + err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code)); + err->Set(Nan::New("errorFunction").ToLocalChecked(), Nan::New("Worktree.add").ToLocalChecked()); + v8::Local argv[1] = { + err + }; + callback->Call(1, argv, async_resource); + if (baton->error->message) + free((void *)baton->error->message); + free((void *)baton->error); + } else if (baton->error_code < 0) { + std::queue< v8::Local > workerArguments; + workerArguments.push(GetFromPersistent("repo")); + workerArguments.push(GetFromPersistent("name")); + workerArguments.push(GetFromPersistent("path")); + workerArguments.push(GetFromPersistent("opts")); + bool callbackFired = false; + while(!workerArguments.empty()) { + v8::Local node = workerArguments.front(); + workerArguments.pop(); + + if ( + !node->IsObject() + || node->IsArray() + || node->IsBooleanObject() + || node->IsDate() + || node->IsFunction() + || node->IsNumberObject() + || node->IsRegExp() + || node->IsStringObject() + ) { + continue; + } + + v8::Local nodeObj = node->ToObject(); + v8::Local checkValue = GetPrivate(nodeObj, Nan::New("NodeGitPromiseError").ToLocalChecked()); + + if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) { + v8::Local argv[1] = { + checkValue->ToObject() + }; + callback->Call(1, argv, async_resource); + callbackFired = true; + break; + } + + v8::Local properties = nodeObj->GetPropertyNames(); + for (unsigned int propIndex = 0; propIndex < properties->Length(); ++propIndex) { + v8::Local propName = properties->Get(propIndex)->ToString(); + v8::Local nodeToQueue = nodeObj->Get(propName); + if (!nodeToQueue->IsUndefined()) { + workerArguments.push(nodeToQueue); + } + } + } + + if (!callbackFired) { + v8::Local err = Nan::Error("Method add has thrown an error.")->ToObject(); + err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code)); + err->Set(Nan::New("errorFunction").ToLocalChecked(), Nan::New("Worktree.add").ToLocalChecked()); + v8::Local argv[1] = { + err + }; + callback->Call(1, argv, async_resource); + } + } else { + callback->Call(0, NULL, async_resource); + } + + } + + + delete baton; +} diff --git a/package-lock.json b/package-lock.json index c1d70a402..f3a607495 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@elastic/nodegit", - "version": "0.25.0-alpha.9", + "version": "0.25.0-alpha.13", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/test/tests/worktree.js b/test/tests/worktree.js new file mode 100644 index 000000000..86dc12b88 --- /dev/null +++ b/test/tests/worktree.js @@ -0,0 +1,49 @@ +var path = require("path"); +var assert = require("assert"); +var fse = require("fs-extra"); +var local = path.join.bind(path, __dirname); + +describe("Worktree", function() { + var NodeGit = require("../../"); + var Repository = NodeGit.Repository; + var Worktree = NodeGit.Worktree; + var Clone = NodeGit.Clone; + + var clonePath = local("../repos/clone"); + var worktreePath = local("../repos/worktree"); + + // Set a reasonable timeout here now that our repository has grown. + this.timeout(30000); + + before(function() { + var test = this; + var url = "https://github.com/nodegit/test.git"; + var opts = { + fetchOpts: { + callbacks: { + certificateCheck: () => 0 + } + } + }; + + return Clone(url, clonePath, opts).then(function(repo) { + assert.ok(repo instanceof Repository); + test.repository = repo; + }); + }); + + after(function() { + return fse.remove(clonePath).catch(function(err) { + console.log(err); + + throw err; + }); + }); + + it("can create worktree", function() { + return Worktree.add(this.repository, "workspace", worktreePath, {}) + .then(function(wt) { + assert.ok(wt instanceof Worktree); + }); + }); +}); From 6936785b30fb4069385812c2acc38fc91b2ab1a8 Mon Sep 17 00:00:00 2001 From: Mengwei Ding Date: Mon, 29 Apr 2019 12:33:00 +0800 Subject: [PATCH 11/22] Revert "Fix binary info's platform passing" This reverts commit 918a517ab6ee2ffe3b84bf97b7cf6b036b0b43a9. --- lib/utils/binary_info.js | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/utils/binary_info.js b/lib/utils/binary_info.js index 4f20c4616..c0ccf60b0 100644 --- a/lib/utils/binary_info.js +++ b/lib/utils/binary_info.js @@ -7,7 +7,6 @@ function binary_info(platform, arch) { var package_json = JSON.parse( fs.readFileSync(path.resolve(__dirname,"../../package.json"), "utf8")); var options = { - platform, target_platform: platform, target_arch: arch }; diff --git a/package.json b/package.json index f9051f9e5..9d925cc32 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.13", + "version": "0.25.0-alpha.12", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", From 38130fe3bd4bf2dd06f92f77dcde60400989dd6d Mon Sep 17 00:00:00 2001 From: Mengwei Ding Date: Mon, 29 Apr 2019 13:34:51 +0800 Subject: [PATCH 12/22] add open worktree test --- .../templates/manual/worktree/worktree_add.cc | 12 +++++++----- package-lock.json | 2 +- package.json | 2 +- test/tests/worktree.js | 16 +++++++--------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/generate/templates/manual/worktree/worktree_add.cc b/generate/templates/manual/worktree/worktree_add.cc index 8277b06f5..203fa73ec 100644 --- a/generate/templates/manual/worktree/worktree_add.cc +++ b/generate/templates/manual/worktree/worktree_add.cc @@ -59,10 +59,11 @@ from_repo = Nan::ObjectWrap::Unwrap(info[0]->ToObject())->GetValu // end convert_from_v8 block baton->path = from_path; // start convert_from_v8 block - // Create a git_worktree_add_options with the default value - const git_worktree_add_options from_opts = {1, 0, NULL}; + // Create a NULL git_worktree_add_options so that libgit2 will + // use a default options. + const git_worktree_add_options* from_opts = NULL; // end convert_from_v8 block - baton->opts = &from_opts; + baton->opts = from_opts; Nan::Callback *callback = new Nan::Callback(v8::Local::Cast(info[4])); AddWorker *worker = new AddWorker(baton, callback); @@ -73,8 +74,9 @@ from_repo = Nan::ObjectWrap::Unwrap(info[0]->ToObject())->GetValu worker->SaveToPersistent("name", info[1]->ToObject()); if (!info[2]->IsUndefined() && !info[2]->IsNull()) worker->SaveToPersistent("path", info[2]->ToObject()); - if (!info[3]->IsUndefined() && !info[3]->IsNull()) - worker->SaveToPersistent("opts", info[3]->ToObject()); + // Completely ignore info[3]. + // if (!info[3]->IsUndefined() && !info[3]->IsNull()) + // worker->SaveToPersistent("opts", info[3]->ToObject()); AsyncLibgit2QueueWorker(worker); return; diff --git a/package-lock.json b/package-lock.json index f3a607495..dad55a67a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@elastic/nodegit", - "version": "0.25.0-alpha.13", + "version": "0.25.0-alpha.14", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 9d925cc32..d92f1477a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.12", + "version": "0.25.0-alpha.14", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", diff --git a/test/tests/worktree.js b/test/tests/worktree.js index 86dc12b88..ecf4c4fb2 100644 --- a/test/tests/worktree.js +++ b/test/tests/worktree.js @@ -1,6 +1,5 @@ var path = require("path"); var assert = require("assert"); -var fse = require("fs-extra"); var local = path.join.bind(path, __dirname); describe("Worktree", function() { @@ -32,18 +31,17 @@ describe("Worktree", function() { }); }); - after(function() { - return fse.remove(clonePath).catch(function(err) { - console.log(err); - - throw err; - }); - }); - it("can create worktree", function() { return Worktree.add(this.repository, "workspace", worktreePath, {}) .then(function(wt) { assert.ok(wt instanceof Worktree); }); }); + + it("can open a worktree repository", function() { + return Repository.open(worktreePath).then(function(repo) { + assert.ok(repo instanceof Repository); + assert.ok(repo.isWorktree()); + }); + }); }); From 6570afbb67b9bb8f5d26cfb8f2223b8913417dee Mon Sep 17 00:00:00 2001 From: Fuyao Zhao Date: Wed, 1 May 2019 12:13:42 -0700 Subject: [PATCH 13/22] Fix osx build, make the build log clean, fix the badge. --- .travis.yml | 11 +++++------ README.md | 2 +- generate/templates/templates/binding.gyp | 3 ++- package-lock.json | 2 +- package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4773206f4..a1ea2d6e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -55,7 +55,7 @@ addons: before_install: - - export CC="clang -fPIC" + - export CC="clang -fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" - export CXX=clang++ - export npm_config_clang=1 - export JOBS=4 @@ -64,8 +64,8 @@ before_install: wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz; tar xfz openssl-1.0.2o.tar.gz; cd openssl-1.0.2o; - CFLAGS="-fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" ./config; - CFLAGS="-fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" TARGET_ARCH="" make; + ./config; + TARGET_ARCH="" make; sudo make install; fi @@ -74,8 +74,8 @@ before_install: wget https://curl.haxx.se/download/curl-7.63.0.tar.gz; tar xfz curl-7.63.0.tar.gz; cd curl-7.63.0; - CFLAGS="-fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" LIBS="-ldl -lpthread" ./configure --disable-shared --with-ssl=/usr/local/ssl/; - CFLAGS="-fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" make; + LIBS="-ldl -lpthread" ./configure --disable-shared --with-ssl=/usr/local/ssl/; + make; sudo make install; fi @@ -113,7 +113,6 @@ script: after_success: - if [ -n "$TRAVIS_TAG" ] && [ "$EXTENDED_TESTING" != "true" ] && [ "$DEPLOY_DOCUMENTATION" != "true" ] && [ "$SKIP_DEPLOY" != "true" ]; then - cd $TRAVIS_BUILD_DIR npm install -g node-pre-gyp; npm install -g aws-sdk; node lifecycleScripts/clean; diff --git a/README.md b/README.md index ddd922d4c..f2d205478 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Linux & macOS | Windows | Coverage | Dependencies ------------- | ------- | -------- | ------------- -[![Build Status Travis](https://api.travis-ci.org/nodegit/nodegit.svg?branch=master)](https://travis-ci.org/nodegit/nodegit) | [![Build Status AppVeyor](https://ci.appveyor.com/api/projects/status/e5a5q75l9yfhnfv2?svg=true)](https://ci.appveyor.com/project/timbranyen/nodegit) | [![Coveralls](https://coveralls.io/repos/nodegit/nodegit/badge.svg)](https://coveralls.io/r/nodegit/nodegit) | [![Dependencies](https://david-dm.org/nodegit/nodegit.svg)](https://david-dm.org/nodegit/nodegit) +[![Build Status Travis](https://api.travis-ci.org/elastic/nodegit.svg?branch=master)](https://travis-ci.org/elastic/nodegit) | [![Build Status AppVeyor](https://ci.appveyor.com/api/projects/status/2mkblygy6c1p2b8f?svg=true)](https://ci.appveyor.com/project/spacedragon/nodegit) | [![Coveralls](https://coveralls.io/repos/nodegit/nodegit/badge.svg)](https://coveralls.io/r/nodegit/nodegit) | [![Dependencies](https://david-dm.org/nodegit/nodegit.svg)](https://david-dm.org/nodegit/nodegit) **Stable (libgit2@v0.27.3): 0.27.3** diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index 7ecdd55e2..e504ca0a1 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -115,8 +115,9 @@ "WARNING_CFLAGS": [ "-Wno-unused-variable", + "-Wno-deprecated-declarations", "-Wint-conversions", - "-Wmissing-field-initializers", + "-Wno-missing-field-initializers", "-Wno-c++11-extensions" ] } diff --git a/package-lock.json b/package-lock.json index dad55a67a..5f9e232b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@elastic/nodegit", - "version": "0.25.0-alpha.14", + "version": "0.25.0-alpha.15", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d92f1477a..63f71e2b4 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.14", + "version": "0.25.0-alpha.19", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", From a84916ace89c6e7de48bebe8a10db65b3068e41a Mon Sep 17 00:00:00 2001 From: Yulong Date: Wed, 8 May 2019 15:28:34 +0800 Subject: [PATCH 14/22] add worktree.js for worktree.prune and Worktree.add (#29) --- generate/input/descriptor.json | 6 + generate/input/libgit2-supplement.json | 7 - .../templates/manual/worktree/worktree_add.cc | 213 ------------------ lib/worktree.js | 26 +++ test/tests/worktree.js | 31 ++- 5 files changed, 53 insertions(+), 230 deletions(-) delete mode 100644 generate/templates/manual/worktree/worktree_add.cc create mode 100644 lib/worktree.js diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index 2909115b6..d16c23cbe 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -4222,6 +4222,12 @@ } } }, + "worktree_prune_options": { + "hasConstructor": true + }, + "worktree_add_options": { + "hasConstructor": true + }, "writestream": { "cType": "git_writestream", "needsForwardDeclaration": false, diff --git a/generate/input/libgit2-supplement.json b/generate/input/libgit2-supplement.json index c78082956..f0a3bf327 100644 --- a/generate/input/libgit2-supplement.json +++ b/generate/input/libgit2-supplement.json @@ -107,13 +107,6 @@ "isPrototypeMethod": false, "group": "clone" }, - "git_worktree_add": { - "isManual": true, - "cFile": "generate/templates/manual/worktree/worktree_add.cc", - "isAsync": true, - "isPrototypeMethod": false, - "group": "worktree" - }, "git_commit_extract_signature": { "args": [ { diff --git a/generate/templates/manual/worktree/worktree_add.cc b/generate/templates/manual/worktree/worktree_add.cc deleted file mode 100644 index 203fa73ec..000000000 --- a/generate/templates/manual/worktree/worktree_add.cc +++ /dev/null @@ -1,213 +0,0 @@ -NAN_METHOD(GitWorktree::Add) { - - if (info.Length() == 0 || !info[0]->IsObject()) { - return Nan::ThrowError("Repository repo is required."); - } - - if (info.Length() == 1 || !info[1]->IsString()) { - return Nan::ThrowError("String name is required."); - } - - if (info.Length() == 2 || !info[2]->IsString()) { - return Nan::ThrowError("String path is required."); - } - - if (info.Length() == 3 || !info[3]->IsObject()) { - return Nan::ThrowError("WorktreeAddOptions opts is required."); - } - - if (info.Length() == 4 || !info[4]->IsFunction()) { - return Nan::ThrowError("Callback is required and must be a Function."); - } - - AddBaton* baton = new AddBaton; - - baton->error_code = GIT_OK; - baton->error = NULL; - -// start convert_from_v8 block - git_repository * from_repo = NULL; -from_repo = Nan::ObjectWrap::Unwrap(info[0]->ToObject())->GetValue(); -// end convert_from_v8 block - baton->repo = from_repo; -// start convert_from_v8 block - const char * from_name = NULL; - - String::Utf8Value name(info[1]->ToString()); - // malloc with one extra byte so we can add the terminating null character C-strings expect: - from_name = (const char *) malloc(name.length() + 1); - // copy the characters from the nodejs string into our C-string (used instead of strdup or strcpy because nulls in - // the middle of strings are valid coming from nodejs): - memcpy((void *)from_name, *name, name.length()); - // ensure the final byte of our new string is null, extra casts added to ensure compatibility with various C types - // used in the nodejs binding generation: - memset((void *)(((char *)from_name) + name.length()), 0, 1); -// end convert_from_v8 block - baton->name = from_name; -// start convert_from_v8 block - const char * from_path = NULL; - - String::Utf8Value path(info[2]->ToString()); - // malloc with one extra byte so we can add the terminating null character C-strings expect: - from_path = (const char *) malloc(path.length() + 1); - // copy the characters from the nodejs string into our C-string (used instead of strdup or strcpy because nulls in - // the middle of strings are valid coming from nodejs): - memcpy((void *)from_path, *path, path.length()); - // ensure the final byte of our new string is null, extra casts added to ensure compatibility with various C types - // used in the nodejs binding generation: - memset((void *)(((char *)from_path) + path.length()), 0, 1); -// end convert_from_v8 block - baton->path = from_path; -// start convert_from_v8 block - // Create a NULL git_worktree_add_options so that libgit2 will - // use a default options. - const git_worktree_add_options* from_opts = NULL; -// end convert_from_v8 block - baton->opts = from_opts; - - Nan::Callback *callback = new Nan::Callback(v8::Local::Cast(info[4])); - AddWorker *worker = new AddWorker(baton, callback); - - if (!info[0]->IsUndefined() && !info[0]->IsNull()) - worker->SaveToPersistent("repo", info[0]->ToObject()); - if (!info[1]->IsUndefined() && !info[1]->IsNull()) - worker->SaveToPersistent("name", info[1]->ToObject()); - if (!info[2]->IsUndefined() && !info[2]->IsNull()) - worker->SaveToPersistent("path", info[2]->ToObject()); - // Completely ignore info[3]. - // if (!info[3]->IsUndefined() && !info[3]->IsNull()) - // worker->SaveToPersistent("opts", info[3]->ToObject()); - - AsyncLibgit2QueueWorker(worker); - return; -} - -void GitWorktree::AddWorker::Execute() { - git_error_clear(); - - { - LockMaster lockMaster( - /*asyncAction: */true - ,baton->repo - ,baton->name - ,baton->path - ,baton->opts - ); - - int result = git_worktree_add( -&baton->out,baton->repo,baton->name,baton->path,baton->opts ); - - baton->error_code = result; - - if (result != GIT_OK && git_error_last() != NULL) { - baton->error = git_error_dup(git_error_last()); - } - - } -} - -void GitWorktree::AddWorker::HandleOKCallback() { - if (baton->error_code == GIT_OK) { - v8::Local to; -// start convert_to_v8 block - if (baton->out != NULL) { - v8::Local owners = Nan::New(0); - Nan::Set(owners, Nan::New(owners->Length()), this->GetFromPersistent("repo")->ToObject()); - to = GitWorktree::New( - baton->out, - true - , owners - ); - } - else { - to = Nan::Null(); - } - // end convert_to_v8 block - v8::Local result = to; - - v8::Local argv[2] = { - Nan::Null(), - result - }; - callback->Call(2, argv, async_resource); - } else { - if (baton->error) { - v8::Local err; - if (baton->error->message) { - err = Nan::Error(baton->error->message)->ToObject(); - } else { - err = Nan::Error("Method add has thrown an error.")->ToObject(); - } - err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code)); - err->Set(Nan::New("errorFunction").ToLocalChecked(), Nan::New("Worktree.add").ToLocalChecked()); - v8::Local argv[1] = { - err - }; - callback->Call(1, argv, async_resource); - if (baton->error->message) - free((void *)baton->error->message); - free((void *)baton->error); - } else if (baton->error_code < 0) { - std::queue< v8::Local > workerArguments; - workerArguments.push(GetFromPersistent("repo")); - workerArguments.push(GetFromPersistent("name")); - workerArguments.push(GetFromPersistent("path")); - workerArguments.push(GetFromPersistent("opts")); - bool callbackFired = false; - while(!workerArguments.empty()) { - v8::Local node = workerArguments.front(); - workerArguments.pop(); - - if ( - !node->IsObject() - || node->IsArray() - || node->IsBooleanObject() - || node->IsDate() - || node->IsFunction() - || node->IsNumberObject() - || node->IsRegExp() - || node->IsStringObject() - ) { - continue; - } - - v8::Local nodeObj = node->ToObject(); - v8::Local checkValue = GetPrivate(nodeObj, Nan::New("NodeGitPromiseError").ToLocalChecked()); - - if (!checkValue.IsEmpty() && !checkValue->IsNull() && !checkValue->IsUndefined()) { - v8::Local argv[1] = { - checkValue->ToObject() - }; - callback->Call(1, argv, async_resource); - callbackFired = true; - break; - } - - v8::Local properties = nodeObj->GetPropertyNames(); - for (unsigned int propIndex = 0; propIndex < properties->Length(); ++propIndex) { - v8::Local propName = properties->Get(propIndex)->ToString(); - v8::Local nodeToQueue = nodeObj->Get(propName); - if (!nodeToQueue->IsUndefined()) { - workerArguments.push(nodeToQueue); - } - } - } - - if (!callbackFired) { - v8::Local err = Nan::Error("Method add has thrown an error.")->ToObject(); - err->Set(Nan::New("errno").ToLocalChecked(), Nan::New(baton->error_code)); - err->Set(Nan::New("errorFunction").ToLocalChecked(), Nan::New("Worktree.add").ToLocalChecked()); - v8::Local argv[1] = { - err - }; - callback->Call(1, argv, async_resource); - } - } else { - callback->Call(0, NULL, async_resource); - } - - } - - - delete baton; -} diff --git a/lib/worktree.js b/lib/worktree.js new file mode 100644 index 000000000..2c032f76e --- /dev/null +++ b/lib/worktree.js @@ -0,0 +1,26 @@ +var NodeGit = require("../"); +var shallowClone = NodeGit.Utils.shallowClone; +var normalizeOptions = NodeGit.Utils.normalizeOptions; + +var Worktree = NodeGit.Worktree; +var _prune = Worktree.prototype.prune; +var _add = Worktree.add; + +Worktree.add = function(repo, name, dir, options) { + if (options) { + options = shallowClone(options); + } else { + options = { lock:0, version: 1 }; + } + options = normalizeOptions(options, NodeGit.WorktreeAddOptions); + return _add.call(this, repo, name, dir, options); +}; + +Worktree.prototype.prune = function(options) { + if (options) { + options = shallowClone(options); + } + options = normalizeOptions(options, NodeGit.WorktreePruneOptions); + return _prune.call(this, options); +}; + diff --git a/test/tests/worktree.js b/test/tests/worktree.js index ecf4c4fb2..e1d183db9 100644 --- a/test/tests/worktree.js +++ b/test/tests/worktree.js @@ -2,7 +2,7 @@ var path = require("path"); var assert = require("assert"); var local = path.join.bind(path, __dirname); -describe("Worktree", function() { +describe("Worktree", function () { var NodeGit = require("../../"); var Repository = NodeGit.Repository; var Worktree = NodeGit.Worktree; @@ -14,34 +14,45 @@ describe("Worktree", function() { // Set a reasonable timeout here now that our repository has grown. this.timeout(30000); - before(function() { + before(function () { var test = this; var url = "https://github.com/nodegit/test.git"; var opts = { - fetchOpts: { - callbacks: { - certificateCheck: () => 0 + fetchOpts: { + callbacks: { + certificateCheck: () => 0 } } }; - return Clone(url, clonePath, opts).then(function(repo) { + return Clone(url, clonePath, opts).then(function (repo) { assert.ok(repo instanceof Repository); test.repository = repo; }); }); - it("can create worktree", function() { + it("can create worktree", function () { return Worktree.add(this.repository, "workspace", worktreePath, {}) - .then(function(wt) { + .then(function (wt) { assert.ok(wt instanceof Worktree); }); }); - it("can open a worktree repository", function() { - return Repository.open(worktreePath).then(function(repo) { + it("can open a worktree repository", function () { + return Repository.open(worktreePath).then(function (repo) { assert.ok(repo instanceof Repository); assert.ok(repo.isWorktree()); }); }); + + it("can prune worktree", function () { + const repository = this.repository; + return Worktree.lookup(repository, "workspace") + .then(function (wt) { + assert.ok(wt instanceof Worktree); + wt.prune({flags: 1}); + return assert.rejects(Worktree.lookup(repository, "workspace")); + }); + }); + }); From 24c258c917ab8e2c46f5f116b651b62b083300b6 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Wed, 8 May 2019 15:30:58 +0800 Subject: [PATCH 15/22] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 63f71e2b4..639f4c086 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.19", + "version": "0.25.0-alpha.20", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", From f2fdbc33402905bddceedc7fb9cc88f0c74b365f Mon Sep 17 00:00:00 2001 From: "yulong.huang" Date: Fri, 14 Jun 2019 06:40:58 -0400 Subject: [PATCH 16/22] try find a ssl root certs file on linux --- generate/templates/templates/binding.gyp | 1 + generate/templates/templates/nodegit.cc | 32 +++++++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index e504ca0a1..e663e3c01 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -178,6 +178,7 @@ "/usr/local/ssl/lib/libssl.a", "/usr/local/ssl/lib/libcrypto.a" ], + "defines": ["_FIND_ROOT_CERTS=1"], "ldflags": [ "-static-libstdc++" ], diff --git a/generate/templates/templates/nodegit.cc b/generate/templates/templates/nodegit.cc index c1eddd328..979b5c787 100644 --- a/generate/templates/templates/nodegit.cc +++ b/generate/templates/templates/nodegit.cc @@ -5,6 +5,7 @@ #include #include #include +#include #include @@ -120,15 +121,44 @@ void OpenSSL_ThreadSetup() { CRYPTO_THREADID_set_callback(OpenSSL_IDCallback); } +inline bool file_exists (const char* name) { + struct stat buffer; + return (stat (name, &buffer) == 0); +} + +extern "C" int git_openssl__set_cert_location(const char *file, const char *path); +static void FindRootCerts() { +# ifdef _FIND_ROOT_CERTS + static const char *path_candiates[4] = { "/etc/ssl/certs/ca-certificates.crt", + "/etc/pki/tls/certs/ca-bundle.crt", + "/usr/share/ssl/certs/ca-bundle.crt", + "/usr/local/share/certs/ca-root-nss.crt" }; + static const char* root_cert = nullptr; + if (root_cert == nullptr) { + for (size_t i = 0; i < sizeof(path_candiates) / sizeof(path_candiates[0]); i++){ + const char* path = path_candiates[i]; + if (file_exists(path)) { + if (git_openssl__set_cert_location(path, nullptr) == 0) { + root_cert = path; + break; + }; + } + } + } +# endif +} ThreadPool libgit2ThreadPool(10, uv_default_loop()); + extern "C" void init(v8::Local target) { // Initialize thread safety in openssl and libssh2 OpenSSL_ThreadSetup(); init_ssh2(); // Initialize libgit2. git_libgit2_init(); - + FindRootCerts(); + + Nan::HandleScope scope; Wrapper::InitializeComponent(target); From 5c6b518a3fc2c4dd1dcc08ad381ba3cea2c693a1 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Mon, 17 Jun 2019 10:10:27 +0800 Subject: [PATCH 17/22] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 639f4c086..36f07db4f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.20", + "version": "0.25.0-alpha.21", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", From 9591cb4ae304b99a920c59a0c7070e0f9945eba6 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Fri, 28 Jun 2019 10:18:01 +0800 Subject: [PATCH 18/22] don't include .pdb files in release package --- lifecycleScripts/clean.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lifecycleScripts/clean.js b/lifecycleScripts/clean.js index a0f7076b3..11512657c 100644 --- a/lifecycleScripts/clean.js +++ b/lifecycleScripts/clean.js @@ -2,4 +2,4 @@ var cleanForPublish = require("clean-for-publish"); var path = require("path"); var location = path.join(__dirname, ".."); -cleanForPublish(location); +cleanForPublish(location, [".node"]); diff --git a/package.json b/package.json index 36f07db4f..e786fc7c5 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.21", + "version": "0.25.0-alpha.22", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", From bcd027d359a7181d795908b2893bdd349399ceb1 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Mon, 1 Jul 2019 17:19:21 +0800 Subject: [PATCH 19/22] build on Centos 6 --- .travis.yml | 56 ++----------- Dockerfile | 24 ++++++ build.sh | 10 +++ build_deps.sh | 23 ++++++ package-lock.json | 205 +++++++++++++++++++++++++++++++++++----------- 5 files changed, 223 insertions(+), 95 deletions(-) create mode 100644 Dockerfile create mode 100755 build.sh create mode 100755 build_deps.sh diff --git a/.travis.yml b/.travis.yml index a1ea2d6e9..437c860a4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ sudo: false # update to Xenial in April 2019; Trusty will be EOL, Xenial new minimum supported OS version -dist: trusty +dist: Xenial branches: only: @@ -9,6 +9,7 @@ branches: compiler: clang language: node_js +services: docker # Stage order; the default stage is "test", which in our case is actually building and deploying stages: @@ -41,58 +42,19 @@ jobs: git: depth: 5 -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - build-essential - - clang - - libssl-dev - - gcc-4.9-multilib - - g++-4.9-multilib - - lcov - before_install: - - export CC="clang -fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" - - export CXX=clang++ - - export npm_config_clang=1 - - export JOBS=4 - - if [ "$TRAVIS_OS_NAME" == "linux" ]; then - cd $HOME; - wget https://www.openssl.org/source/openssl-1.0.2o.tar.gz; - tar xfz openssl-1.0.2o.tar.gz; - cd openssl-1.0.2o; - ./config; - TARGET_ARCH="" make; - sudo make install; - fi - - - if [ "$TRAVIS_OS_NAME" == "linux" ]; then - cd $HOME; - wget https://curl.haxx.se/download/curl-7.63.0.tar.gz; - tar xfz curl-7.63.0.tar.gz; - cd curl-7.63.0; - LIBS="-ldl -lpthread" ./configure --disable-shared --with-ssl=/usr/local/ssl/; - make; - sudo make install; - fi - - cd $TRAVIS_BUILD_DIR - - if [ -z "$TRAVIS_TAG" ] && [ "$EXTENDED_TESTING" == "true" ]; then - export GYP_DEFINES="coverage=1 use_obsolete_asm=true"; - export npm_config_clang=0; - wget http://downloads.sourceforge.net/ltp/lcov-1.10.tar.gz; - tar xfz lcov-1.10.tar.gz; - else - export GYP_DEFINES="use_obsolete_asm=true"; - fi + install: - set -e; - - travis_retry npm install; - + - if [ "$TRAVIS_OS_NAME" == "linux" ]; then + docker run -v `pwd`:/build --rm spacedragon/centos6_builder:v2 /build/build.sh; + fi + - if [ "$TRAVIS_OS_NAME" == "osx" ]; then + travis_retry npm install; + fi # This is a random private key used purely for testing. before_script: - echo -e "Host *\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..be6847a1a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM centos:6 + +ENV SHELL /bin/bash +WORKDIR /build + +RUN yum -y update +RUN yum -y install epel-release curl +RUN curl http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo --output /etc/yum.repos.d/slc6-scl.repo && \ + yum -y --nogpgcheck install devtoolset-3-gcc devtoolset-3-gcc-c++ git make openssl-devel + +ENV NVM_DIR /usr/local/nvm +ENV NODE_VERSION 10 + +# Install nvm with node and npm +RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.30.1/install.sh | bash \ + && source $NVM_DIR/nvm.sh \ + && nvm install $NODE_VERSION \ + && nvm alias default $NODE_VERSION \ + && nvm use default + +WORKDIR /src +ADD build_deps.sh src/ +RUN src/build_deps.sh +CMD scl enable devtoolset-3 bash diff --git a/build.sh b/build.sh new file mode 100755 index 000000000..87a597f0b --- /dev/null +++ b/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +source scl_source enable devtoolset-3 +export CC="gcc -fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" +export CXX=g++ + +cd /build +source ~/.bashrc +npm install +npm run rebuild \ No newline at end of file diff --git a/build_deps.sh b/build_deps.sh new file mode 100755 index 000000000..60b2fd38c --- /dev/null +++ b/build_deps.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +source scl_source enable devtoolset-3 +export CC="gcc -fPIC -Wno-deprecated-declarations -Wno-missing-field-initializers" +export CXX=g++ +mkdir -p /src +cd /src + +curl https://www.openssl.org/source/openssl-1.0.2o.tar.gz -o openssl-1.0.2o.tar.gz +tar xfz openssl-1.0.2o.tar.gz +cd openssl-1.0.2o +./config +TARGET_ARCH="" make +make install + +cd /src +curl https://curl.haxx.se/download/curl-7.63.0.tar.gz -o curl-7.63.0.tar.gz +tar xfz curl-7.63.0.tar.gz +cd curl-7.63.0 +LIBS="-ldl -lpthread" ./configure --disable-shared --with-ssl=/usr/local/ssl/ +make +make install + diff --git a/package-lock.json b/package-lock.json index 5f9e232b2..3fedc1e16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@elastic/nodegit", - "version": "0.25.0-alpha.15", + "version": "0.25.0-alpha.22", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -101,13 +101,15 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true + "dev": true, + "optional": true }, "arr-union": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true + "dev": true, + "optional": true }, "array-unique": { "version": "0.2.1", @@ -138,7 +140,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", - "dev": true + "dev": true, + "optional": true }, "async": { "version": "1.5.2", @@ -162,7 +165,8 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", - "dev": true + "dev": true, + "optional": true }, "aws-sdk": { "version": "2.326.0", @@ -791,6 +795,7 @@ "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", "dev": true, + "optional": true, "requires": { "cache-base": "^1.0.1", "class-utils": "^0.3.5", @@ -806,6 +811,7 @@ "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", "dev": true, + "optional": true, "requires": { "is-descriptor": "^1.0.0" } @@ -815,6 +821,7 @@ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, + "optional": true, "requires": { "kind-of": "^6.0.0" } @@ -824,6 +831,7 @@ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, + "optional": true, "requires": { "kind-of": "^6.0.0" } @@ -833,6 +841,7 @@ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, + "optional": true, "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", @@ -843,13 +852,15 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "dev": true, + "optional": true }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true + "dev": true, + "optional": true } } }, @@ -973,6 +984,7 @@ "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true, + "optional": true, "requires": { "collection-visit": "^1.0.0", "component-emitter": "^1.2.1", @@ -989,7 +1001,8 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "dev": true, + "optional": true } } }, @@ -1081,6 +1094,7 @@ "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", "dev": true, + "optional": true, "requires": { "arr-union": "^3.1.0", "define-property": "^0.2.5", @@ -1093,6 +1107,7 @@ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, + "optional": true, "requires": { "is-descriptor": "^0.1.0" } @@ -1101,7 +1116,8 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "dev": true, + "optional": true } } }, @@ -1209,6 +1225,7 @@ "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", "dev": true, + "optional": true, "requires": { "map-visit": "^1.0.0", "object-visit": "^1.0.0" @@ -1245,7 +1262,8 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", @@ -1302,7 +1320,8 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true + "dev": true, + "optional": true }, "core-js": { "version": "2.5.7", @@ -1416,7 +1435,8 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true + "dev": true, + "optional": true }, "deep-extend": { "version": "0.6.0", @@ -1443,6 +1463,7 @@ "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", "dev": true, + "optional": true, "requires": { "is-descriptor": "^1.0.2", "isobject": "^3.0.1" @@ -1453,6 +1474,7 @@ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", "dev": true, + "optional": true, "requires": { "kind-of": "^6.0.0" } @@ -1462,6 +1484,7 @@ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", "dev": true, + "optional": true, "requires": { "kind-of": "^6.0.0" } @@ -1471,6 +1494,7 @@ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", "dev": true, + "optional": true, "requires": { "is-accessor-descriptor": "^1.0.0", "is-data-descriptor": "^1.0.0", @@ -1481,13 +1505,15 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "dev": true, + "optional": true }, "kind-of": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true + "dev": true, + "optional": true } } }, @@ -1704,6 +1730,7 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", "dev": true, + "optional": true, "requires": { "assign-symbols": "^1.0.0", "is-extendable": "^1.0.1" @@ -1714,6 +1741,7 @@ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, + "optional": true, "requires": { "is-plain-object": "^2.0.4" } @@ -1816,7 +1844,8 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true + "dev": true, + "optional": true }, "for-own": { "version": "0.1.5", @@ -1854,6 +1883,7 @@ "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", "dev": true, + "optional": true, "requires": { "map-cache": "^0.2.2" } @@ -1932,7 +1962,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -1953,12 +1984,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1973,17 +2006,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -2100,7 +2136,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -2112,6 +2149,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -2126,6 +2164,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -2133,12 +2172,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -2157,6 +2198,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -2237,7 +2279,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -2249,6 +2292,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -2334,7 +2378,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -2370,6 +2415,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -2389,6 +2435,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -2432,12 +2479,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -2477,7 +2526,8 @@ "version": "2.0.6", "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true + "dev": true, + "optional": true }, "getpass": { "version": "0.1.7", @@ -2516,6 +2566,7 @@ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", "dev": true, + "optional": true, "requires": { "is-glob": "^2.0.0" } @@ -2656,6 +2707,7 @@ "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", "dev": true, + "optional": true, "requires": { "get-value": "^2.0.6", "has-values": "^1.0.0", @@ -2666,7 +2718,8 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "dev": true, + "optional": true } } }, @@ -2675,6 +2728,7 @@ "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "dev": true, + "optional": true, "requires": { "is-number": "^3.0.0", "kind-of": "^4.0.0" @@ -2685,6 +2739,7 @@ "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2" }, @@ -2694,6 +2749,7 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, + "optional": true, "requires": { "is-buffer": "^1.1.5" } @@ -2705,6 +2761,7 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", "dev": true, + "optional": true, "requires": { "is-buffer": "^1.1.5" } @@ -2858,6 +2915,7 @@ "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2" } @@ -2883,6 +2941,7 @@ "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2" } @@ -2892,6 +2951,7 @@ "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", "dev": true, + "optional": true, "requires": { "is-accessor-descriptor": "^0.1.6", "is-data-descriptor": "^0.1.4", @@ -2902,7 +2962,8 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true + "dev": true, + "optional": true } } }, @@ -2927,13 +2988,15 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true + "dev": true, + "optional": true }, "is-extglob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true + "dev": true, + "optional": true }, "is-finite": { "version": "1.0.2", @@ -2957,6 +3020,7 @@ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true, + "optional": true, "requires": { "is-extglob": "^1.0.0" } @@ -2982,6 +3046,7 @@ "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true, + "optional": true, "requires": { "isobject": "^3.0.1" }, @@ -2990,7 +3055,8 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "dev": true, + "optional": true } } }, @@ -3290,6 +3356,7 @@ "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true, + "optional": true, "requires": { "is-buffer": "^1.1.5" } @@ -3381,13 +3448,15 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true + "dev": true, + "optional": true }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "dev": true, + "optional": true, "requires": { "object-visit": "^1.0.0" } @@ -3476,6 +3545,7 @@ "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", "dev": true, + "optional": true, "requires": { "for-in": "^1.0.2", "is-extendable": "^1.0.1" @@ -3486,6 +3556,7 @@ "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", "dev": true, + "optional": true, "requires": { "is-plain-object": "^2.0.4" } @@ -3789,6 +3860,7 @@ "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", "dev": true, + "optional": true, "requires": { "copy-descriptor": "^0.1.0", "define-property": "^0.2.5", @@ -3800,6 +3872,7 @@ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, + "optional": true, "requires": { "is-descriptor": "^0.1.0" } @@ -3817,6 +3890,7 @@ "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", "dev": true, + "optional": true, "requires": { "isobject": "^3.0.0" }, @@ -3825,7 +3899,8 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "dev": true, + "optional": true } } }, @@ -3857,6 +3932,7 @@ "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", "dev": true, + "optional": true, "requires": { "isobject": "^3.0.1" }, @@ -3865,7 +3941,8 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "dev": true, + "optional": true } } }, @@ -3983,7 +4060,8 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true + "dev": true, + "optional": true }, "path-dirname": { "version": "1.0.2", @@ -4251,7 +4329,8 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true + "dev": true, + "optional": true }, "braces": { "version": "2.3.2", @@ -4514,7 +4593,8 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true + "dev": true, + "optional": true }, "micromatch": { "version": "3.1.10", @@ -4578,6 +4658,7 @@ "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", "dev": true, + "optional": true, "requires": { "extend-shallow": "^3.0.2", "safe-regex": "^1.1.0" @@ -4648,13 +4729,15 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", - "dev": true + "dev": true, + "optional": true }, "repeat-string": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true + "dev": true, + "optional": true }, "repeating": { "version": "2.0.1", @@ -4752,13 +4835,15 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true + "dev": true, + "optional": true }, "ret": { "version": "0.1.15", "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "dev": true + "dev": true, + "optional": true }, "rimraf": { "version": "2.6.2", @@ -4778,6 +4863,7 @@ "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", "dev": true, + "optional": true, "requires": { "ret": "~0.1.10" } @@ -4808,6 +4894,7 @@ "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", "dev": true, + "optional": true, "requires": { "extend-shallow": "^2.0.1", "is-extendable": "^0.1.1", @@ -4820,6 +4907,7 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, + "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -4848,6 +4936,7 @@ "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", "dev": true, + "optional": true, "requires": { "base": "^0.11.1", "debug": "^2.2.0", @@ -4864,6 +4953,7 @@ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, + "optional": true, "requires": { "is-descriptor": "^0.1.0" } @@ -4873,6 +4963,7 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, + "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -4944,7 +5035,8 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true + "dev": true, + "optional": true } } }, @@ -4969,6 +5061,7 @@ "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", "dev": true, + "optional": true, "requires": { "atob": "^2.1.1", "decode-uri-component": "^0.2.0", @@ -4990,7 +5083,8 @@ "version": "0.4.0", "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true + "dev": true, + "optional": true }, "split": { "version": "1.0.1", @@ -5007,6 +5101,7 @@ "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", "dev": true, + "optional": true, "requires": { "extend-shallow": "^3.0.0" } @@ -5045,6 +5140,7 @@ "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", "dev": true, + "optional": true, "requires": { "define-property": "^0.2.5", "object-copy": "^0.1.0" @@ -5055,6 +5151,7 @@ "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", "dev": true, + "optional": true, "requires": { "is-descriptor": "^0.1.0" } @@ -5215,6 +5312,7 @@ "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2" } @@ -5224,6 +5322,7 @@ "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", "dev": true, + "optional": true, "requires": { "define-property": "^2.0.2", "extend-shallow": "^3.0.2", @@ -5352,6 +5451,7 @@ "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", "dev": true, + "optional": true, "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", @@ -5364,6 +5464,7 @@ "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true, + "optional": true, "requires": { "is-extendable": "^0.1.0" } @@ -5373,6 +5474,7 @@ "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", "dev": true, + "optional": true, "requires": { "extend-shallow": "^2.0.1", "is-extendable": "^0.1.1", @@ -5402,6 +5504,7 @@ "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", "dev": true, + "optional": true, "requires": { "has-value": "^0.3.1", "isobject": "^3.0.0" @@ -5412,6 +5515,7 @@ "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", "dev": true, + "optional": true, "requires": { "get-value": "^2.0.3", "has-values": "^0.1.4", @@ -5423,6 +5527,7 @@ "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", "dev": true, + "optional": true, "requires": { "isarray": "1.0.0" } @@ -5433,13 +5538,15 @@ "version": "0.1.4", "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true + "dev": true, + "optional": true }, "isobject": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true + "dev": true, + "optional": true } } }, @@ -5447,7 +5554,8 @@ "version": "0.1.0", "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true + "dev": true, + "optional": true }, "url": { "version": "0.10.3", @@ -5471,7 +5579,8 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", - "dev": true + "dev": true, + "optional": true }, "user-home": { "version": "1.1.1", From da28a644f074d965d1674956392f0d641f9a0236 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Tue, 2 Jul 2019 17:03:36 +0800 Subject: [PATCH 20/22] fix permission problem in travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 437c860a4..9ee4f8f18 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,6 +51,7 @@ install: - set -e; - if [ "$TRAVIS_OS_NAME" == "linux" ]; then docker run -v `pwd`:/build --rm spacedragon/centos6_builder:v2 /build/build.sh; + sudo chown -R travis:travis .; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then travis_retry npm install; From a455f6630601a946c376ceff4914f9ae0d3949f6 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Wed, 31 Jul 2019 09:10:58 +0800 Subject: [PATCH 21/22] bump version --- .gitignore | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3d571d1c7..e8b7f258f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,7 @@ .DS_STORE .idea -.vscode +.vscode/ jsconfig.json test/id_rsa diff --git a/package.json b/package.json index e786fc7c5..0a21ff548 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.22", + "version": "0.25.0-alpha.23", "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", From 0c7e6a5039a03bb715307800d1ef7bbb3c7732b8 Mon Sep 17 00:00:00 2001 From: spacedragon Date: Fri, 2 Aug 2019 15:41:39 +0800 Subject: [PATCH 22/22] Also add .vscode folder to .npmignore --- .gitignore | 2 +- .npmignore | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e8b7f258f..a3800d195 100644 --- a/.gitignore +++ b/.gitignore @@ -38,7 +38,7 @@ *.log .DS_STORE -.idea +.idea/ .vscode/ jsconfig.json diff --git a/.npmignore b/.npmignore index 046bdf56a..0268ad671 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,6 @@ /.travis/ +/.vscode/ +/.idea/ /build/ /examples/ /generate/