Permalink
Browse files

Converted more constructors over

  • Loading branch information...
1 parent b52067a commit 5b1ed27582325f287caace19d1bc068d62a58d4e @tbranyen tbranyen committed Jul 9, 2014
Showing with 21 additions and 20 deletions.
  1. +6 −9 lib/reference.js
  2. +9 −9 lib/repository.js
  3. +2 −0 lib/revwalk.js
  4. +2 −0 lib/tree.js
  5. +2 −2 lib/util/normalize_oid.js
View
@@ -1,14 +1,9 @@
-var git = require("../"),
- Reference = git.Refs;
+var NodeGit = require("../");
-// Backwards compatibility.
-Object.defineProperty(git, "Reference", {
- value: Reference,
- enumerable: false
-});
+var Reference = NodeGit.Refs;
-var oldSymbolicTarget = Reference.prototype.symbolicTarget,
- oldTarget = Reference.prototype.target;
+var oldSymbolicTarget = Reference.prototype.symbolicTarget;
+var oldTarget = Reference.prototype.target;
Reference.Type = {
Oid: 1,
@@ -65,3 +60,5 @@ Reference.prototype.target = function() {
Reference.prototype.toString = function() {
return this.name();
};
+
+module.exports = Reference;
View
@@ -1,13 +1,13 @@
-var git = require("../");
+var NodeGit = require("../");
var normalizeOid = require("./util/normalize_oid");
-
-var TreeBuilder = git.Treebuilder;
-var Commit = git.Commit;
-var Revwalk = git.Revwalk;
-var Repository = git.Repository;
-var Blob = git.Blob;
-var Tree = git.Tree;
-var Reference = git.Reference;
+var Blob = require("./blob");
+var Tree = require("./tree");
+var Reference = require("./reference");
+var Revwalk = require("./revwalk");
+var Commit = require("./commit");
+
+var TreeBuilder = NodeGit.Treebuilder;
+var Repository = NodeGit.Repository;
/**
* Look up a branch"s most recent commit.
View
@@ -75,3 +75,5 @@ Revwalk.prototype.walk = function(oid, callback) {
util.normalizeOid(Revwalk.prototype, "walk");
util.makeSafe(Revwalk.prototype, "walk");
+
+module.exports = Revwalk;
View
@@ -158,3 +158,5 @@ Tree.prototype.builder = function() {
builder.repo = this.repo;
return builder;
};
+
+module.exports = Tree;
@@ -1,4 +1,4 @@
-var git = require("../../");
+var NodeGit = require("../../");
/**
* Normalize an identifier to always be an OID instance.
@@ -8,7 +8,7 @@ var git = require("../../");
*/
function normalizeOid(oid) {
try {
- return typeof oid === "string" ? git.Oid.fromString(oid) : oid;
+ return typeof oid === "string" ? NodeGit.Oid.fromString(oid) : oid;
}
catch (ex) {
return null;

0 comments on commit 5b1ed27

Please sign in to comment.