Skip to content

Commit 81fef29

Browse files
author
Dan Butvinik
committed
bump to nodegit 0.25.0-alpha.1
1 parent 51eb18b commit 81fef29

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

README.md

+14-8
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ npm install pgp-commit
1616
See more examples in examples folder
1717

1818
```js
19-
const git = require("nodegit")
20-
const pgpCommit = require("pgp-commit")
19+
const git = require('nodegit')
20+
const pgpCommit = require('pgp-commit')
2121

2222
run()
2323

2424
async function run() {
2525
// clone a repo
26-
const repo = await git.Clone("https://github.com/owner/repo", "/temp/repo")
27-
const commitMessage = "add data to something"
28-
const author = git.Signature.now("test", "[email protected]")
29-
const committer = git.Signature.now("test", "[email protected]")
26+
const repo = await git.Clone('https://github.com/owner/repo', '/temp/repo')
27+
const commitMessage = 'add data to something'
28+
const author = git.Signature.now('test', '[email protected]')
29+
const committer = git.Signature.now('test', '[email protected]')
3030

3131
// make a change
32-
fs.writeFileSync("/temp/repo/nothing", "nothing")
32+
fs.writeFileSync('/temp/repo/nothing', 'nothing')
3333

3434
// stage the change
3535
const index = await repo.refreshIndex()
@@ -48,6 +48,12 @@ async function run() {
4848
}
4949
```
5050

51-
## Add your GPG key to github
51+
## Add your public GPG key to github
5252

5353
see https://help.github.com/articles/adding-a-new-gpg-key-to-your-github-account/
54+
55+
## Get your private key from cmd line
56+
57+
```
58+
$ gpg --export-secret-key -a "username"
59+
```

index.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ async function sign({
1111
}) {
1212
const index = await repo.refreshIndex()
1313
const oid = await index.writeTreeTo(repo)
14-
const currentBranch = await repo.getBranch('HEAD')
1514
const head = await git.Reference.nameToId(repo, 'HEAD')
1615
const parent = await repo.getCommit(head)
1716
const commit = await repo.createCommitWithSignature(
17+
'HEAD',
1818
author,
1919
committer,
2020
commitMessage,
@@ -23,7 +23,6 @@ async function sign({
2323
'gpgsig',
2424
onSignature
2525
)
26-
await currentBranch.setTarget(commit.toString(), 'updating head')
2726
return commit.toString()
2827

2928
async function onSignature(tosign) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "dabutvin",
77
"license": "MIT",
88
"dependencies": {
9-
"nodegit": "^0.23.0",
9+
"nodegit": "^0.25.0-alpha.1",
1010
"openpgp": "^4.2.2"
1111
}
1212
}

0 commit comments

Comments
 (0)