Skip to content

Commit b259162

Browse files
committed
Merge pull request #102 from micha149/example-fixes
Reviewd and fixed examples
2 parents 1364bc6 + 586d25b commit b259162

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

example/apps/git_profanity_check.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
var git = require('../../');
99

1010
var curses = ['add', 'swears', 'here'],
11-
path = './.git',
11+
path = '../../.git',
1212
branchName = 'master',
1313
reCurse = new RegExp('\\b(?:' + curses.join('|') + ')\\b', 'gi');
1414

example/general.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
2828
// **nodegit** uses a simple wrapper around hash values called an `Oid`.
2929
// The oid validates that the SHA is well-formed.
3030

31-
var oid = git.Oid.fromString('fd373a561d63bfc0a5665608fe057f2131d81fee');
31+
var oid = git.Oid.fromString('c27d9c35e3715539d941254f2ce57042b978c49c');
3232

3333
// Most functions in in **nodegit** that take an oid will also take a
3434
// string, so for example, you can look up a commit by a string SHA or
@@ -158,7 +158,7 @@ git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
158158
// functions very similarly to the commit lookup, parsing and creation
159159
// methods, since the objects themselves are very similar.
160160

161-
oid = git.Oid.fromString("97f6d755647aca272e7c8003323472cefca772fc");
161+
oid = git.Oid.fromString("43f0ac7359e30b769f6b1714e0adbaf51bedbb65");
162162
repo.getTag(oid, function(error, tag) {
163163
if (error) throw error;
164164

@@ -175,6 +175,7 @@ git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
175175
});
176176
});
177177

178+
178179
// #### Tree Parsing
179180

180181
// A Tree is how Git represents the state of the filesystem
@@ -315,8 +316,8 @@ git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
315316
repo.getReference(referenceName, function(error, reference) {
316317
if (error) throw error;
317318

318-
if (reference.isOid()) {
319-
console.log("Reference:", referenceName, reference.oid());
319+
if (reference.isConcrete()) {
320+
console.log("Reference:", referenceName, reference.target());
320321
} else if (reference.isSymbolic()) {
321322
console.log("Reference:", referenceName, reference.symbolicTarget());
322323
}

example/new-commit.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var git = require('../'),
77
git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
88
if (error) throw error;
99

10-
repo.getCommit('0a70ef1237bc1ea50dbccd395e1a114201b75a68', function(error, commit) {
10+
repo.getCommit('eebd0ead15d62eaf0ba276da53af43bbc3ce43ab', function(error, commit) {
1111
if (error) throw error;
1212

1313
commit.getTree(function(error, tree) {

lib/object.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ git.Object.Type = {
1818
* @return {Boolean}
1919
*/
2020
git.Object.prototype.isCommit = function() {
21-
return this.type() == Object.Type.Commit;
21+
return this.type() == git.Object.Type.Commit;
2222
};
2323

2424
/**
2525
* Is this object a tree?
2626
* @return {Boolean}
2727
*/
2828
git.Object.prototype.isTree = function() {
29-
return this.type() == Object.Type.Tree;
29+
return this.type() == git.Object.Type.Tree;
3030
};
3131

3232
/**
3333
* Is this object a blob?
3434
* @return {Boolean}
3535
*/
3636
git.Object.prototype.isBlob = function() {
37-
return this.type() == Object.Type.Blob;
37+
return this.type() == git.Object.Type.Blob;
3838
};
3939

4040
/**
4141
* Is this object a tag?
4242
* @return {Boolean}
4343
*/
4444
git.Object.prototype.isTag = function() {
45-
return this.type() == Object.Type.Tag;
45+
return this.type() == git.Object.Type.Tag;
4646
};

0 commit comments

Comments
 (0)