Tag: nodegit

Nodegit克隆不工作?

我正在尝试使用Nodegit插件将一些git repos 复制到名为“tmp”的目录中,这样我就可以对实际文件夹进行操作(将其上传到服务器)。 这是我的代码: var git = require('nodegit'); var repos = [some https repo urls] var options = { remoteCallbacks: { certificateCheck: function() { return 1; } } }; for(i = 0; i<repos.length; i++){ git.Clone(repos[i], './tmp', options).catch(function(err) { console.error(err); } ); } 它所做的只是在一瞬间创build一个名为“tmp”的空目录并将其删除。 我得到的错误是./tmp' exists and is not an empty directory (但它不存在?)和authentication required but no […]

如何列出在提交中更改的文件的path?

我现在可以走一个特定的分支来获取提交的细节(即作者,时间戳等),但是我也想获得受提交影响的文件。 我曾经尝试过: commit.getDiff().then(function(arrayDiff) { arrayDiff.forEach(function(diff) { diff.patches().then(function(patches) { patches.forEach(function(patch) { console.log("diff", patch.oldFile().path(), patch.newFile().path()); }); }); }); }); 问题似乎是在diff.patches().then(function(patches) 。我可以添加日志logging语句,并看到arrayDiff有项目,foreach正在为它工作,但我的代码永远达不到arrayDiff 。 我究竟做错了什么? 有没有更好的方式来获取作为提交一部分的文件的path?

处理promise中的返回值nodejs

我已经在NodeJs中构build了这个函数, var Git = require('nodegit'); var fse = require('fs-extra'); var path = require('path'); var fs = require('fs'); var repoPath = 'D:\\sample' function gitCommitHistory(repoPath, callbackGitCommitHistory) { try { var open = Git.Repository.open; var commitList = []; open(repoPath) .then(function(repo) { return repo.getMasterCommit(); }) .then(function(firstCommitOnMaster) { var history = firstCommitOnMaster.history(); history.on("commit", function(commit) { if (commit === 'undefined') { […]

从node.js应用程序pipe理git repo

我需要从Node.js应用程序pipe理一个git仓库。 有没有一个git包装库或东西,让我调用git函数高层次,并解释结果,而不必分析控制台输出?

在npm安装期间,libssh2中的“C编译器无法创build可执行文件”

在npm安装nodegit的过程中,我得到以下错误: > nodegit@0.15.1 preinstall /home/mhu/nodegit > node lifecycleScripts/preinstall [nodegit] Running pre-install script [nodegit] npm@2 installed, pre-loading required packages [nodegit] Configuring libssh2. { [Error: Command failed: /bin/sh -c /home/mhu/nodegit/vendor/libssh2/configure –with-libssl-prefix=/home/mhu/nodegit/vendor/openssl/openssl configure: error: in `/home/mhu/nodegit/vendor/libssh2': configure: error: C compiler cannot create executables See `config.log' for more details ] killed: false, code: 77, signal: null, cmd: '/bin/sh -c […]

require(“nodegit”)阻止脚本退出

我无法使用nodegit (v0.9.0)。 任何require软件包的.js脚本将永远挂起而不能退出。 例: var nodegit = require('nodegit'); console.log("hello world"); 在命令行上运行这个命令会导致预期的控制台输出,但脚本永远不会退出。 我需要使用ctrl-C从脚本中获取控制权。 但是,如果我评论一下这个要求声明: // var nodegit = require('nodegit'); console.log("hello world"); 事情工作得很好。 我在Windows(7)和Linux(CentOS 7.1.1503)上遇到过这种情况。 这两台机器都使用v4.2.0的节点。 我猜这不是一个错误,而且我滥用图书馆,但我不明白我可能做错了什么。

Nodegit – 在两个提交之间获得差异

我有两个分支master和master.min在我的回购。 假设我的当前分支是master.min 。 我的主分支在提交 – abcd 一些推动发生在主分支 – efgh , ijkl 我存储了我的主分支的当前提交: repo.getBranchCommit("master") .then(function(commit) { startCommit = commit; }) 由于分支机构之间的切换时间很长,我需要在master.min上执行所有的操作 所以,我做了一个提取: repo.fetch("master"); 现在,我需要获取在abcd & ijkl之间添加,修改或删除的所有文件的列表 commit.getDiff() is not enough. I need diff between two commits.

是否有一个nodegit相当于`$ git add -N *`和`$ git diff –name-only`?

就像标题所说的那样。 我一直在寻找一段时间,但还没有find任何线索。

运行npm install unbuilds global npm

我有一个依赖于nodegit的项目。 当我跑步 npm install -g . 我在某个时候得到这个输出: 当npm完成安装时,我无法访问它的path: 我最终不得不运行'n',转换到以前版本的节点,然后再次运行'n'以转换到最新版本的节点,最后运行'npm install -g npm @ latest'来获得最新版本的npm。

使用NodeGit读取Gitconfigurationvariables

NodeGit似乎没有提供任何API来检索Gitconfiguration值。 请参阅http://www.nodegit.org/#Config 我期待像Config#getValue()或类似的API来检索configuration值。 也许,它现在在NodeGit中是缺less的,因为libgit2有这些API。 任何提示?