Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More constructors refactored

  • Loading branch information...
commit b52067acaa755c3b3fc21b484ffed2bce4150f62 1 parent be111f0
@tbranyen tbranyen authored
View
2  lib/convenient_hunk.js
@@ -32,4 +32,4 @@ ConvenientHunk.prototype.lines = function() {
return result;
};
-exports.ConvenientHunk = ConvenientHunk;
+module.exports = ConvenientHunk;
View
2  lib/convenient_patch.js
@@ -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;
View
13 lib/index.js
@@ -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;
View
28 lib/object.js
@@ -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. */
@@ -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;
View
16 lib/odb.js
@@ -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;
View
7 lib/oid.js
@@ -1,5 +1,6 @@
-var git = require("../"),
- Oid = git.Oid;
+var NodeGit = require("../");
+
+var Oid = NodeGit.Oid;
// Backwards compatibility.
Object.defineProperties(Oid.prototype, {
@@ -19,3 +20,5 @@ Object.defineProperties(Oid, {
Oid.prototype.inspect = function() {
return "[Oid " + this.allocfmt() + "]";
};
+
+module.exports = Oid;
Please sign in to comment.
Something went wrong with that request. Please try again.