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
statusfile is not a function? and reset.reset not promisifying
  • Loading branch information
maxkorp committed Mar 3, 2015
commit 9d4777be839e868e22b6a31934bfbf0b745719ec
3 changes: 2 additions & 1 deletion generate/templates/templates/enums.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ NodeGit.Enums = {};
{% each . as enumerable %}
{% if not enumerable.ignore %}
{% if enumerable.type == "enum" %}
NodeGit.{{ enumerable.owner }}.{{ enumerable.JsName }} = {
NodeGit.{{ enumerable.owner }}.{{ enumerable.JsName }} =
NodeGit.{{ enumerable.owner }}.__proto__.{{ enumerable.JsName }} = {
{% each enumerable.values as value %}
{{ value.JsName }}: {{ value.value }},
{% endeach %}
Expand Down
6 changes: 0 additions & 6 deletions lib/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,4 @@ Clone.clone = function(url, local_path, options) {
.then(openRepository);
};

// Inherit directly from the original clone object.
Clone.clone.__proto__ = Clone;

// Ensure we're using the correct prototype.
Clone.clone.prototype = Clone.prototype;

module.exports = Clone.clone;
20 changes: 4 additions & 16 deletions lib/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,17 @@ var NodeGit = require("../");
var normalizeOptions = require("./util/normalize_options");

var Reset = NodeGit.Reset;

var defaultFn = Reset.default;

Reset.default = function(repo, target, pathspecs) {
return defaultFn.call(this, repo, target, pathspecs);
};

var reset = Reset.reset;
Reset.reset = function( repo,
target,
resetType,
checkoutOpts,
signature,
logMessage) {
checkoutOpts = normalizeOptions(checkoutOpts, NodeGit.CheckoutOptions);
Reset.reset = function(repo, target, resetType, opts, signature, logMessage) {
opts = normalizeOptions(opts, NodeGit.CheckoutOptions);

return reset.call(
this,
repo,
target,
resetType,
checkoutOpts,
signature,
logMessage);
return reset.call(this, repo, target, resetType, opts, signature, logMessage);
};

module.exports = Reset;
7 changes: 4 additions & 3 deletions test/tests/attr.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ var path = require("path");
var local = path.join.bind(path, __dirname);

describe("Attr", function() {
var Repository = require(local("../../lib/repository"));
var Attr = require(local("../../lib/attr"));
var Status = require(local("../../lib/status"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Attr = NodeGit.Attr;
var Status = NodeGit.Status;

var reposPath = local("../repos/workdir/.git");

Expand Down
8 changes: 5 additions & 3 deletions test/tests/blob.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ var path = require("path");
var local = path.join.bind(path, __dirname);

describe("Blob", function() {
var Oid = require(local("../../lib/oid"));
var Repository = require(local("../../lib/repository"));
var FileMode = require(local("../../lib/tree_entry")).FILEMODE;
var NodeGit = require(local("../../"));

var Oid = NodeGit.Oid;
var Repository = NodeGit.Repository;
var FileMode = NodeGit.TreeEntry.FILEMODE;

var reposPath = local("../repos/workdir/.git");
var oid = "111dd657329797f6165f52f5085f61ac976dcf04";
Expand Down
5 changes: 3 additions & 2 deletions test/tests/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ var Promise = require("nodegit-promise");
var local = path.join.bind(path, __dirname);

describe("Branch", function() {
var Repository = require(local("../../lib/repository"));
var Branch = require(local("../../lib/branch"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Branch = NodeGit.Branch;
var branchName = "test-branch";
var fullBranchName = "refs/heads/" + branchName;

Expand Down
5 changes: 3 additions & 2 deletions test/tests/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ var path = require("path");
var local = path.join.bind(path, __dirname);

describe("Checkout", function() {
var Repository = require(local("../../lib/repository"));
var Checkout = require(local("../../lib/checkout"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Checkout = NodeGit.Checkout;

var packageJsonOid = "0fa56e90e096a4c24c785206b826ab914ea3de1e";
var reposPath = local("../repos/workdir/.git");
Expand Down
35 changes: 26 additions & 9 deletions test/tests/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ var fse = promisify(require("fs-extra"));
var local = path.join.bind(path, __dirname);

describe("Clone", function() {
var Repository = require(local("../../lib/repository"));
var clone = require(local("../../lib/clone"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Clone = NodeGit.Clone;

var clonePath = local("../repos/clone");

Expand All @@ -29,7 +29,7 @@ describe("Clone", function() {
var test = this;
var url = "http://git.tbranyen.com/smart/site-content";

return clone(url, clonePath).then(function(repo) {
return Clone(url, clonePath).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -46,7 +46,24 @@ describe("Clone", function() {
}
};

return clone(url, clonePath, opts).then(function(repo) {
return Clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
});

it("can clone using nested function", function() {
var test = this;
var url = "https://github.com/nodegit/test.git";
var opts = {
remoteCallbacks: {
certificateCheck: function() {
return 1;
}
}
};

return Clone.clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -66,7 +83,7 @@ describe("Clone", function() {
}
};

return clone(url, clonePath, opts).then(function(repo) {
return Clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -90,7 +107,7 @@ describe("Clone", function() {
}
};

return clone(url, clonePath, opts).then(function(repo) {
return Clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -107,7 +124,7 @@ describe("Clone", function() {
}
};

return clone(url, clonePath, opts).then(function(repo) {
return Clone(url, clonePath, opts).then(function(repo) {
test.repository = repo;
assert.ok(repo instanceof Repository);
});
Expand All @@ -118,7 +135,7 @@ describe("Clone", function() {
var prefix = process.platform === "win32" ? "" : "file://";
var url = prefix + local("../repos/empty");

return clone(url, clonePath).then(function(repo) {
return Clone(url, clonePath).then(function(repo) {
assert.ok(repo instanceof Repository);
test.repository = repo;
});
Expand All @@ -127,7 +144,7 @@ describe("Clone", function() {
it("will not segfault when accessing a url without username", function() {
var url = "https://github.com/nodegit/private";

return clone(url, clonePath, {
return Clone(url, clonePath, {
remoteCallbacks: {
certificateCheck: function() {
return 1;
Expand Down
5 changes: 3 additions & 2 deletions test/tests/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ var fse = promisify(require("fs-extra"));
var local = path.join.bind(path, __dirname);

describe("Diff", function() {
var Repository = require(local("../../lib/repository"));
var Diff = require(local("../../lib/diff"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Diff = NodeGit.Diff;

var reposPath = local("../repos/workdir/.git");
var oid = "fce88902e66c72b5b93e75bdb5ae717038b221f6";
Expand Down
5 changes: 3 additions & 2 deletions test/tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ var writeFile = promisify(function(filename, data, callback) {
});

describe("Index", function() {
var Repository = require(local("../../lib/repository"));

var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;

var reposPath = local("../repos/workdir/.git");

beforeEach(function() {
Expand Down
7 changes: 4 additions & 3 deletions test/tests/odb.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ var path = require("path");
var local = path.join.bind(path, __dirname);

describe("Odb", function() {
var Repository = require(local("../../lib/repository"));
var Oid = require(local("../../lib/oid"));
var Obj = require(local("../../lib/object"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Oid = NodeGit.Oid;
var Obj = NodeGit.Object;

var reposPath = local("../repos/workdir/.git");

Expand Down
3 changes: 2 additions & 1 deletion test/tests/oid.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ var path = require("path");
var local = path.join.bind(path, __dirname);

describe("Oid", function() {
var Oid = require(local("../../lib/oid"));
var NodeGit = require(local("../../"));
var Oid = NodeGit.Oid;

var oid = "fce88902e66c72b5b93e75bdb5ae717038b221f6";

Expand Down
5 changes: 3 additions & 2 deletions test/tests/refs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ var exec = promisify(function(command, opts, callback) {
});

describe("Reference", function() {
var Repository = require(local("../../lib/repository"));
var Reference = require(local("../../lib/reference"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Reference = NodeGit.Reference;

var reposPath = local("../repos/workdir");

Expand Down
4 changes: 2 additions & 2 deletions test/tests/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ var local = path.join.bind(path, __dirname);

describe("Remote", function() {
var NodeGit = require(local("../../"));
var Repository = require(local("../../lib/repository"));
var Remote = require(local("../../lib/remote"));
var Repository = NodeGit.Repository;
var Remote = NodeGit.Remote;

var reposPath = local("../repos/workdir/.git");
var url = "https://github.com/nodegit/test";
Expand Down
9 changes: 5 additions & 4 deletions test/tests/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ var fse = promisify(require("fs-extra"));
var local = path.join.bind(path, __dirname);

describe("Repository", function() {
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Index = NodeGit.Index;
var Signature = NodeGit.Signature;

var reposPath = local("../repos/workdir/.git");
var newRepo = local("../repos/newrepo");

var Repository = require(local("../../lib/repository"));
var Index = require(local("../../lib/index"));
var Signature = require(local("../../lib/signature"));

beforeEach(function() {
var test = this;

Expand Down
5 changes: 3 additions & 2 deletions test/tests/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ var promisify = require("promisify-node");
var fse = promisify(require("fs-extra"));

describe("Reset", function() {
var Repository = require(local("../../lib/repository"));
var Reset = require(local("../../lib/reset"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Reset = NodeGit.Reset;

var reposPath = local("../repos/workdir/.git");
var currentCommitOid = "32789a79e71fbc9e04d3eff7425e1771eb595150";
Expand Down
7 changes: 4 additions & 3 deletions test/tests/revwalk.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ var path = require("path");
var local = path.join.bind(path, __dirname);

describe("Revwalk", function() {
var Repository = require(local("../../lib/repository"));
var Revwalk = require(local("../../lib/revwalk"));
var Oid = require(local("../../lib/oid"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Revwalk = NodeGit.Revwalk;
var Oid = NodeGit.Oid;

var reposPath = local("../repos/workdir/.git");

Expand Down
5 changes: 3 additions & 2 deletions test/tests/signature.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ var exec = promisify(function(command, opts, callback) {
});

describe("Signature", function() {
var Signature = require(local("../../lib/signature"));
var Repository = require(local("../../lib/repository"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Signature = NodeGit.Signature;

var reposPath = local("../repos/workdir/.git");

Expand Down
5 changes: 3 additions & 2 deletions test/tests/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ var exec = promisify(function(command, opts, callback) {
});

describe("Status", function() {
var Status = require(local("../../lib/status"));
var Repository = require(local("../../lib/repository"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Status = NodeGit.Status;

var reposPath = local("../repos/workdir/.git");

Expand Down
5 changes: 3 additions & 2 deletions test/tests/status_file.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ var path = require("path");
var local = path.join.bind(path, __dirname);

describe("StatusFile", function() {
var Status = require(local("../../lib/status"));
var StatusFile = require(local("../../lib/status_file"));
var NodeGit = require(local("../../"));
var Status = NodeGit.Status;
var StatusFile = NodeGit.StatusFile;

var pathName = "README.md";
var statusCode = Status.STATUS.WT_NEW;
Expand Down
7 changes: 4 additions & 3 deletions test/tests/status_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ var exec = promisify(function(command, opts, callback) {
});

describe("StatusList", function() {
var Status = require(local("../../lib/status"));
var StatusList = require(local("../../lib/status_list"));
var Repository = require(local("../../lib/repository"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Status = NodeGit.Status;
var StatusList = NodeGit.StatusList;

var reposPath = local("../repos/workdir/.git");

Expand Down
13 changes: 7 additions & 6 deletions test/tests/tag.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
var assert = require("assert");
var path = require("path");
var local = path.join.bind(path, __dirname);
var Promise = require("nodegit-promise");

describe("Tag", function() {
var Repository = require(local("../../lib/repository"));
var Tag = require(local("../../lib/tag"));
var Obj = require(local("../../lib/object"));
var Oid = require(local("../../lib/oid"));
var Reference = require(local("../../lib/reference"));
var Promise = require("nodegit-promise");
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Tag = NodeGit.Tag;
var Obj = NodeGit.Object;
var Oid = NodeGit.Oid;
var Reference = NodeGit.Reference;

var reposPath = local("../repos/workdir/.git");
var tagName = "annotated-tag";
Expand Down
5 changes: 3 additions & 2 deletions test/tests/tree_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ var path = require("path");
var local = path.join.bind(path, __dirname);

describe("TreeEntry", function() {
var Repository = require(local("../../lib/repository"));
var Tree = require(local("../../lib/tree"));
var NodeGit = require(local("../../"));
var Repository = NodeGit.Repository;
var Tree = NodeGit.Tree;

var reposPath = local("../repos/workdir/.git");
var oid = "5716e9757886eaf38d51c86b192258c960d9cfea";
Expand Down