nodegit

Get diff between two tags with nodegit

故事扮演 提交于 2021-02-08 08:20:15
问题 How do I get the diff between two tags using nodegit? On the command line, I can see the diff between two tags, no problemo. Additionally, I can use nodegit to list the tags in my repo: const Git = require('nodegit') const path = require('path') Git.Repository.open(path.resolve(__dirname, '.git')) .then((repo) => { console.log('Opened repo ...') Git.Tag.list(repo).then((array) => { console.log('Tags:') console.log(array) }) }) However, I am not sure how to find the diff between two tags in

Incorrect NODE_MODULE_VERSION when using ava

≯℡__Kan透↙ 提交于 2020-12-13 03:51:53
问题 I write an Electron app that uses nodegit. For my test part I use ava in combination with Spectron to test my app. All of my tests work - including functions which use nodegit in my app. In addition to the tests described above I made also a pure non-Electron test file in which I import nodegit directly. import * as nodegit from 'nodegit'; Executing this test now via ava returns this: node_modules\.pnpm\nodegit@0.27.0\node_modules\nodegit\build\Release\nodegit.node' was compiled against a

Incorrect NODE_MODULE_VERSION when using ava

淺唱寂寞╮ 提交于 2020-12-13 03:49:25
问题 I write an Electron app that uses nodegit. For my test part I use ava in combination with Spectron to test my app. All of my tests work - including functions which use nodegit in my app. In addition to the tests described above I made also a pure non-Electron test file in which I import nodegit directly. import * as nodegit from 'nodegit'; Executing this test now via ava returns this: node_modules\.pnpm\nodegit@0.27.0\node_modules\nodegit\build\Release\nodegit.node' was compiled against a

Incorrect NODE_MODULE_VERSION when using ava

强颜欢笑 提交于 2020-12-13 03:49:25
问题 I write an Electron app that uses nodegit. For my test part I use ava in combination with Spectron to test my app. All of my tests work - including functions which use nodegit in my app. In addition to the tests described above I made also a pure non-Electron test file in which I import nodegit directly. import * as nodegit from 'nodegit'; Executing this test now via ava returns this: node_modules\.pnpm\nodegit@0.27.0\node_modules\nodegit\build\Release\nodegit.node' was compiled against a

Reading Git config variable using NodeGit

丶灬走出姿态 提交于 2020-02-03 04:55:09
问题 NodeGit does not seem to be providing any API to retrieve Git configuration values. See http://www.nodegit.org/#Config I was expecting something like Config#getValue() or similar API to retrieve configuration values. Perhaps, it is missing in NodeGit as of now, since libgit2 has those APIs. Any hints? 回答1: NodeGit currently doesn't expose the config functionality of libgit2. That shouldn't be too hard to get in there but I don't know if it'll make into the 0.3.0 release that is scheduled for

“C compiler cannot create executables” in libssh2 during npm install

寵の児 提交于 2020-01-15 03:59:30
问题 I got the following error during npm install of 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

Switch Branch/Tag with nodegit

六眼飞鱼酱① 提交于 2019-12-22 03:46:29
问题 I have been trying all morning to open an existing repo and change branch or tag using nodegit. The documentation is extensive but seems to be out of date. Any ideas on what I'm doing wrong? var NodeGit = require("nodegit"); var open = NodeGit.Repository.open; var Tag = NodeGit.Tag; var Checkout = NodeGit.Checkout; open(location).then(function (repo) { Tag.list(repo).then(function(array) { // array is ['v1.0.0'] var ref = array[0] Checkout.tree(repo, ref).then(function() { // Want tag to be

Nodegit: How to modify a file and push the changes?

好久不见. 提交于 2019-11-28 23:28:54
Looked around for an example, but couldn't find one. The documentation is not explained and I could not figure it out. How to modify a file (README.md for example), create a commit for the modified file and then push the commit to the server ? Nodegit: http://www.nodegit.org/ Nodegit documentation: http://www.nodegit.org/nodegit Rafael There is an example of how to create/add and commit on their repo, which can help you with the modifying the file. https://github.com/nodegit/nodegit/blob/master/examples/add-and-commit.js Regarding the commit and push, here is the snippet of how my code looks

Nodegit: How to modify a file and push the changes?

半世苍凉 提交于 2019-11-27 14:51:15
问题 Looked around for an example, but couldn't find one. The documentation is not explained and I could not figure it out. How to modify a file (README.md for example), create a commit for the modified file and then push the commit to the server ? Nodegit: http://www.nodegit.org/ Nodegit documentation: http://www.nodegit.org/nodegit 回答1: There is an example of how to create/add and commit on their repo, which can help you with the modifying the file. https://github.com/nodegit/nodegit/blob/master