Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More constructors refactored
  • Loading branch information
tbranyen committed Jul 11, 2014
commit b52067acaa755c3b3fc21b484ffed2bce4150f62
2 changes: 1 addition & 1 deletion lib/convenient_hunk.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ ConvenientHunk.prototype.lines = function() {
return result;
};

exports.ConvenientHunk = ConvenientHunk;
module.exports = ConvenientHunk;
2 changes: 1 addition & 1 deletion lib/convenient_patch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var git = require("../");
var Diff = git.Diff;
var ConvenientHunk = require("./convenient_hunk").ConvenientHunk;
var ConvenientHunk = require("./convenient_hunk");

function ConvenientPatch(delta, patch) {
this.delta = delta;
Expand Down
13 changes: 9 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
var git = require("../"),
Index = git.Index;
var NodeGit = require("../");

var Index = NodeGit.Index;

/**
* Return an array of the entries in this index.
* @return {[IndexEntry]} an array of IndexEntrys
*/
Index.prototype.entries = function() {
var size = this.size(),
result = [];
var size = this.size();
var result = [];

for (var i = 0; i < size; i++) {
result.push(this.entry(i));
}

return result;
};

module.exports = Index;
28 changes: 16 additions & 12 deletions lib/object.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
var git = require("../");
var NodeGit = require("../");

git.Object.Type = {
Any: -2, /**< Object can be any of the following */
Bad: -1, /**< Object is invalid. */
var Obj = NodeGit.Object;

Obj.Type = {
Any: -2, /**< Obj can be any of the following */
Bad: -1, /**< Obj is invalid. */
Ext1: 0, /**< Reserved for future use. */
Commit: 1, /**< A commit object. */
Tree: 2, /**< A tree (directory listing) object. */
Expand All @@ -17,30 +19,32 @@ git.Object.Type = {
* Is this object a commit?
* @return {Boolean}
*/
git.Object.prototype.isCommit = function() {
return this.type() == git.Object.Type.Commit;
Obj.prototype.isCommit = function() {
return this.type() == Obj.Type.Commit;
};

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

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

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

module.exports = Obj;
16 changes: 4 additions & 12 deletions lib/odb.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
var git = require("../"),
util = require("./util.js"),
Odb = git.Odb;
var git = require("../");

/**
* Retrieve the object identified by oid.
*
* @param {String|Oid} String sha or Oid
* @param {Function} callback
* @return {git.Object} a git odb object
*/
util.normalizeOid(Odb.prototype, "read");
util.makeSafe(Odb.prototype, "read");
var Odb = git.Odb;

module.exports = Odb;
7 changes: 5 additions & 2 deletions lib/oid.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var git = require("../"),
Oid = git.Oid;
var NodeGit = require("../");

var Oid = NodeGit.Oid;

// Backwards compatibility.
Object.defineProperties(Oid.prototype, {
Expand All @@ -19,3 +20,5 @@ Object.defineProperties(Oid, {
Oid.prototype.inspect = function() {
return "[Oid " + this.allocfmt() + "]";
};

module.exports = Oid;