Skip to content

Commit 2b30a26

Browse files
authored
Merge pull request nodegit#1582 from GitNiko/master
More suitable example about Signature
2 parents eeb2e38 + f7ef327 commit 2b30a26

7 files changed

Lines changed: 28 additions & 28 deletions

File tree

examples/add-and-commit.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
5757
return repo.getCommit(head);
5858
})
5959
.then(function(parent) {
60-
var author = nodegit.Signature.create("Scott Chacon",
61-
"schacon@gmail.com", 123456789, 60);
62-
var committer = nodegit.Signature.create("Scott A Chacon",
63-
"scott@github.com", 987654321, 90);
60+
var author = nodegit.Signature.now("Scott Chacon",
61+
"schacon@gmail.com");
62+
var committer = nodegit.Signature.now("Scott A Chacon",
63+
"scott@github.com");
6464

6565
return repo.createCommit("HEAD", author, committer, "message", oid, [parent]);
6666
})

examples/create-new-repo.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ fse.ensureDir(path.resolve(__dirname, repoDir))
3232
return index.writeTree();
3333
})
3434
.then(function(oid) {
35-
var author = nodegit.Signature.create("Scott Chacon",
36-
"schacon@gmail.com", 123456789, 60);
37-
var committer = nodegit.Signature.create("Scott A Chacon",
38-
"scott@github.com", 987654321, 90);
35+
var author = nodegit.Signature.now("Scott Chacon",
36+
"schacon@gmail.com");
37+
var committer = nodegit.Signature.now("Scott A Chacon",
38+
"scott@github.com");
3939

4040
// Since we're creating an inital commit, it has no parents. Note that unlike
4141
// normal we don't get the head either, because there isn't one yet.

examples/general.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
138138

139139
// nodegit provides a couple of methods to create commit objects easily as
140140
// well.
141-
var author = nodegit.Signature.create("Scott Chacon",
142-
"schacon@gmail.com", 123456789, 60);
143-
var committer = nodegit.Signature.create("Scott A Chacon",
144-
"scott@github.com", 987654321, 90);
141+
var author = nodegit.Signature.now("Scott Chacon",
142+
"schacon@gmail.com");
143+
var committer = nodegit.Signature.now("Scott A Chacon",
144+
"scott@github.com");
145145

146146
// Commit objects need a tree to point to and optionally one or more
147147
// parents. Here we're creating oid objects to create the commit with,

examples/merge-cleanly.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ var theirCommit;
1818
var ourBranch;
1919
var theirBranch;
2020

21-
var ourSignature = nodegit.Signature.create("Ron Paul",
22-
"RonPaul@TollRoadsRBest.info", 123456789, 60);
23-
var theirSignature = nodegit.Signature.create("Greg Abbott",
24-
"Gregggg@IllTollYourFace.us", 123456789, 60);
21+
var ourSignature = nodegit.Signature.now("Ron Paul",
22+
"RonPaul@TollRoadsRBest.info");
23+
var theirSignature = nodegit.Signature.now("Greg Abbott",
24+
"Gregggg@IllTollYourFace.us");
2525

2626
// Create a new repository in a clean directory, and add our first file
2727
fse.remove(path.resolve(__dirname, repoDir))

examples/merge-with-conflicts.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ var ourFileContent = "Big Bobs are best, IMHO.\n";
1010
var theirFileContent = "Nobody expects the small Bobquisition!\n";
1111
var finalFileContent = "Big Bobs are beautiful and the small are unexpected!\n";
1212

13-
var baseSignature = nodegit.Signature.create("Peaceful Bob",
14-
"justchill@bob.net", 123456789, 60);
15-
var ourSignature = nodegit.Signature.create("Big Bob",
16-
"impressive@bob.net", 123456789, 60);
17-
var theirSignature = nodegit.Signature.create("Small Bob",
18-
"underestimated@bob.net", 123456789, 60);
13+
var baseSignature = nodegit.Signature.now("Peaceful Bob",
14+
"justchill@bob.net");
15+
var ourSignature = nodegit.Signature.now("Big Bob",
16+
"impressive@bob.net");
17+
var theirSignature = nodegit.Signature.now("Small Bob",
18+
"underestimated@bob.net");
1919

2020
var ourBranchName = "ours";
2121
var theirBranchName = "theirs";

examples/push.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ var repoDir = "../../newRepo";
1010
var repository;
1111
var remote;
1212

13-
var signature = nodegit.Signature.create("Foo bar",
14-
"foo@bar.com", 123456789, 60);
13+
var signature = nodegit.Signature.now("Foo bar",
14+
"foo@bar.com");
1515

1616
// Create a new repository in a clean directory, and add our first file
1717
fse.remove(path.resolve(__dirname, repoDir))

examples/remove-and-commit.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
4040
return _repository.getCommit(head);
4141
})
4242
.then(function(parent) {
43-
var author = nodegit.Signature.create("Scott Chacon",
44-
"schacon@gmail.com", 123456789, 60);
45-
var committer = nodegit.Signature.create("Scott A Chacon",
46-
"scott@github.com", 987654321, 90);
43+
var author = nodegit.Signature.now("Scott Chacon",
44+
"schacon@gmail.com");
45+
var committer = nodegit.Signature.now("Scott A Chacon",
46+
"scott@github.com");
4747

4848
return _repository.createCommit("HEAD", author, committer,
4949
"message", _oid, [parent]);

0 commit comments

Comments
 (0)