diff --git a/.gitignore b/.gitignore index 3d571d1c7..a3800d195 100644 --- a/.gitignore +++ b/.gitignore @@ -38,9 +38,9 @@ *.log .DS_STORE -.idea +.idea/ -.vscode +.vscode/ jsconfig.json test/id_rsa diff --git a/.npmignore b/.npmignore index 046bdf56a..0268ad671 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,6 @@ /.travis/ +/.vscode/ +/.idea/ /build/ /examples/ /generate/ diff --git a/.travis.yml b/.travis.yml index 682ca1cf9..9ee4f8f18 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: Xenial branches: only: @@ -8,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: @@ -21,7 +23,6 @@ env: node_js: - "10" - - "8" os: - linux @@ -35,50 +36,26 @@ 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 -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - build-essential - - libssl-dev - - gcc-4.9-multilib - - g++-4.9-multilib - - lcov before_install: - - export CC=clang - - export CXX=clang++ - - export npm_config_clang=1 - - export JOBS=4 + - 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; - 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; + sudo chown -R travis:travis .; + 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 @@ -106,17 +83,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/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/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/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/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/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 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/generate/templates/templates/binding.gyp b/generate/templates/templates/binding.gyp index 3d2d80a0d..e663e3c01 100644 --- a/generate/templates/templates/binding.gyp +++ b/generate/templates/templates/binding.gyp @@ -75,7 +75,9 @@ ], "cflags": [ - "-Wall" + "-Wno-deprecated-declarations", + "-Wno-missing-field-initializers", + "-fPIC" ], "conditions": [ @@ -113,8 +115,9 @@ "WARNING_CFLAGS": [ "-Wno-unused-variable", + "-Wno-deprecated-declarations", "-Wint-conversions", - "-Wmissing-field-initializers", + "-Wno-missing-field-initializers", "-Wno-c++11-extensions" ] } @@ -154,7 +157,7 @@ } ], [ - "OS=='linux' or OS.endswith('bsd') or <(is_IBMi) == 1", { + "OS.endswith('bsd') or <(is_IBMi) == 1", { "cflags": [ "-std=c++11" ] @@ -168,6 +171,19 @@ ], } ], + [ + "OS=='linux'", { + "libraries": [ + "/usr/local/lib/libcurl.a", + "/usr/local/ssl/lib/libssl.a", + "/usr/local/ssl/lib/libcrypto.a" + ], + "defines": ["_FIND_ROOT_CERTS=1"], + "ldflags": [ + "-static-libstdc++" + ], + } + ], [ "<(is_IBMi) == 1", { "include_dirs": [ 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); 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/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/lib/utils/binary_info.js b/lib/utils/binary_info.js new file mode 100644 index 000000000..c0ccf60b0 --- /dev/null +++ b/lib/utils/binary_info.js @@ -0,0 +1,17 @@ +var versioning = require("node-pre-gyp/lib/util/versioning"); +var napi = require("node-pre-gyp/lib/util/napi"); +var fs = require("fs"); +var path = require("path"); + +function binary_info(platform, arch) { + var package_json = JSON.parse( + fs.readFileSync(path.resolve(__dirname,"../../package.json"), "utf8")); + var options = { + target_platform: platform, + target_arch: arch + }; + var napi_build_version = napi.get_napi_build_version_from_command_args([]); + var info = versioning.evaluate(package_json, options, napi_build_version); + return info; +} +module.exports = binary_info; 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/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-lock.json b/package-lock.json index 04dff435c..3fedc1e16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "nodegit", - "version": "0.25.0-alpha.9", + "name": "@elastic/nodegit", + "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" } @@ -2586,6 +2637,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 +2649,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 +2657,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 } } }, @@ -2653,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", @@ -2663,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 } } }, @@ -2672,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" @@ -2682,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" }, @@ -2691,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" } @@ -2702,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" } @@ -2855,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" } @@ -2880,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" } @@ -2889,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", @@ -2899,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 } } }, @@ -2924,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", @@ -2954,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" } @@ -2979,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" }, @@ -2987,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 } } }, @@ -3287,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" } @@ -3378,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" } @@ -3473,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" @@ -3483,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" } @@ -3786,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", @@ -3797,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" } @@ -3814,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" }, @@ -3822,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 } } }, @@ -3854,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" }, @@ -3862,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 } } }, @@ -3878,6 +3958,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 +3967,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 } } }, @@ -3978,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", @@ -4246,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", @@ -4509,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", @@ -4573,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" @@ -4643,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", @@ -4747,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", @@ -4773,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" } @@ -4803,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", @@ -4815,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" } @@ -4843,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", @@ -4859,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" } @@ -4868,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" } @@ -4939,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 } } }, @@ -4964,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", @@ -4985,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", @@ -5002,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" } @@ -5040,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" @@ -5050,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" } @@ -5210,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" } @@ -5219,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", @@ -5307,6 +5411,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 +5422,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 } } @@ -5344,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", @@ -5356,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" } @@ -5365,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", @@ -5394,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" @@ -5404,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", @@ -5415,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" } @@ -5425,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 } } }, @@ -5439,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", @@ -5463,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", diff --git a/package.json b/package.json index f523fdae1..0a21ff548 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "nodegit", + "name": "@elastic/nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.25.0-alpha.9", - "homepage": "http://nodegit.org", + "version": "0.25.0-alpha.23", + "homepage": "http://github.com/elastic/nodegit", "keywords": [ "libgit2", "git2", @@ -10,25 +10,11 @@ "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", + "types": "types/index.d.ts", "repository": { "type": "git", - "url": "git://github.com/nodegit/nodegit.git" + "url": "git://github.com/elastic/nodegit.git" }, "directories": { "build": "./build", @@ -71,7 +57,7 @@ "binary": { "module_name": "nodegit", "module_path": "./build/Release/", - "host": "https://axonodegit.s3.amazonaws.com/nodegit/nodegit/" + "host": "https://download.elasticsearch.org/code/nodegit/" }, "scripts": { "babel": "babel --presets es2015 -d ./dist ./lib", 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/test/tests/worktree.js b/test/tests/worktree.js new file mode 100644 index 000000000..e1d183db9 --- /dev/null +++ b/test/tests/worktree.js @@ -0,0 +1,58 @@ +var path = require("path"); +var assert = require("assert"); +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; + }); + }); + + 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()); + }); + }); + + 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")); + }); + }); + +}); 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..a84822a69 --- /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, + DIRECT = 1, + SYMBOLIC = 2, + ALL = 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..2c7ba67d0 --- /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, 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). + */ + 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; +}