FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Reviewd and fixed examples by micha149 · Pull Request #102 · nodegit/nodegit · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .js  (4) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion example/apps/git_profanity_check.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
var git = require('../../');

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

Expand Down
9 changes: 5 additions & 4 deletions example/general.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
// **nodegit** uses a simple wrapper around hash values called an `Oid`.
// The oid validates that the SHA is well-formed.

var oid = git.Oid.fromString('fd373a561d63bfc0a5665608fe057f2131d81fee');
var oid = git.Oid.fromString('c27d9c35e3715539d941254f2ce57042b978c49c');

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

oid = git.Oid.fromString("97f6d755647aca272e7c8003323472cefca772fc");
oid = git.Oid.fromString("43f0ac7359e30b769f6b1714e0adbaf51bedbb65");
repo.getTag(oid, function(error, tag) {
if (error) throw error;

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


// #### Tree Parsing

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

if (reference.isOid()) {
console.log("Reference:", referenceName, reference.oid());
if (reference.isConcrete()) {
console.log("Reference:", referenceName, reference.target());
} else if (reference.isSymbolic()) {
console.log("Reference:", referenceName, reference.symbolicTarget());
}
Expand Down
2 changes: 1 addition & 1 deletion example/new-commit.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var git = require('../'),
git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
if (error) throw error;

repo.getCommit('0a70ef1237bc1ea50dbccd395e1a114201b75a68', function(error, commit) {
repo.getCommit('eebd0ead15d62eaf0ba276da53af43bbc3ce43ab', function(error, commit) {
if (error) throw error;

commit.getTree(function(error, tree) {
Expand Down
8 changes: 4 additions & 4 deletions lib/object.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ git.Object.Type = {
* @return {Boolean}
*/
git.Object.prototype.isCommit = function() {
return this.type() == Object.Type.Commit;
return this.type() == git.Object.Type.Commit;
};

/**
* Is this object a tree?
* @return {Boolean}
*/
git.Object.prototype.isTree = function() {
return this.type() == Object.Type.Tree;
return this.type() == git.Object.Type.Tree;
};

/**
* Is this object a blob?
* @return {Boolean}
*/
git.Object.prototype.isBlob = function() {
return this.type() == Object.Type.Blob;
return this.type() == git.Object.Type.Blob;
};

/**
* Is this object a tag?
* @return {Boolean}
*/
git.Object.prototype.isTag = function() {
return this.type() == Object.Type.Tag;
return this.type() == git.Object.Type.Tag;
};

Back | FazBrowse Home | New Git URL