Skip to content

Commit d8f75a3

Browse files
committed
add missing index.write() and remove extras
1 parent 049fbd0 commit d8f75a3

File tree

7 files changed

+13
-1518
lines changed

7 files changed

+13
-1518
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
package-lock.json

.vscode/launch.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,25 @@ 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()
3636
await index.addAll()
37+
await index.write()
3738

3839
// make a signed commit
3940
const commitId = await pgpCommit({

examples/clone-and-commit.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ async function run() {
1818
// add to the stage
1919
const index = await repo.refreshIndex()
2020
await index.addAll()
21+
await index.write()
2122

2223
// do the signed commit in place
2324
const commitId = await pgpCommit({
@@ -33,6 +34,7 @@ async function run() {
3334

3435
run()
3536

37+
// never check in a real private key
3638
const sample_private_key = `-----BEGIN PGP PRIVATE KEY BLOCK-----
3739
Version: BCPG C# v1.6.1.0
3840
@@ -65,4 +67,5 @@ s0IzD2i+KIfn2dH5wDqs0pPbvhJIWp/i3u4Q+kL4DxdNoqXog8+82qr5b6Is
6567
=rqAt
6668
-----END PGP PRIVATE KEY BLOCK-----`
6769

68-
const sample_password = 'testpassword'
70+
// never check in a real password
71+
const sample_password = 'testpassword'

0 commit comments

Comments
 (0)