Skip to content

Commit 9d4777b

Browse files
committed
statusfile is not a function? and reset.reset not promisifying
1 parent ed903e5 commit 9d4777b

File tree

23 files changed

+99
-80
lines changed

23 files changed

+99
-80
lines changed

generate/templates/templates/enums.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ NodeGit.Enums = {};
44
{% each . as enumerable %}
55
{% if not enumerable.ignore %}
66
{% if enumerable.type == "enum" %}
7-
NodeGit.{{ enumerable.owner }}.{{ enumerable.JsName }} = {
7+
NodeGit.{{ enumerable.owner }}.{{ enumerable.JsName }} =
8+
NodeGit.{{ enumerable.owner }}.__proto__.{{ enumerable.JsName }} = {
89
{% each enumerable.values as value %}
910
{{ value.JsName }}: {{ value.value }},
1011
{% endeach %}

lib/clone.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,4 @@ Clone.clone = function(url, local_path, options) {
4545
.then(openRepository);
4646
};
4747

48-
// Inherit directly from the original clone object.
49-
Clone.clone.__proto__ = Clone;
50-
51-
// Ensure we're using the correct prototype.
52-
Clone.clone.prototype = Clone.prototype;
53-
5448
module.exports = Clone.clone;

lib/reset.js

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,17 @@ var NodeGit = require("../");
22
var normalizeOptions = require("./util/normalize_options");
33

44
var Reset = NodeGit.Reset;
5-
65
var defaultFn = Reset.default;
6+
77
Reset.default = function(repo, target, pathspecs) {
88
return defaultFn.call(this, repo, target, pathspecs);
99
};
1010

1111
var reset = Reset.reset;
12-
Reset.reset = function( repo,
13-
target,
14-
resetType,
15-
checkoutOpts,
16-
signature,
17-
logMessage) {
18-
checkoutOpts = normalizeOptions(checkoutOpts, NodeGit.CheckoutOptions);
12+
Reset.reset = function(repo, target, resetType, opts, signature, logMessage) {
13+
opts = normalizeOptions(opts, NodeGit.CheckoutOptions);
1914

20-
return reset.call(
21-
this,
22-
repo,
23-
target,
24-
resetType,
25-
checkoutOpts,
26-
signature,
27-
logMessage);
15+
return reset.call(this, repo, target, resetType, opts, signature, logMessage);
2816
};
2917

3018
module.exports = Reset;

test/tests/attr.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ var path = require("path");
33
var local = path.join.bind(path, __dirname);
44

55
describe("Attr", function() {
6-
var Repository = require(local("../../lib/repository"));
7-
var Attr = require(local("../../lib/attr"));
8-
var Status = require(local("../../lib/status"));
6+
var NodeGit = require(local("../../"));
7+
var Repository = NodeGit.Repository;
8+
var Attr = NodeGit.Attr;
9+
var Status = NodeGit.Status;
910

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

test/tests/blob.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ var path = require("path");
33
var local = path.join.bind(path, __dirname);
44

55
describe("Blob", function() {
6-
var Oid = require(local("../../lib/oid"));
7-
var Repository = require(local("../../lib/repository"));
8-
var FileMode = require(local("../../lib/tree_entry")).FILEMODE;
6+
var NodeGit = require(local("../../"));
7+
8+
var Oid = NodeGit.Oid;
9+
var Repository = NodeGit.Repository;
10+
var FileMode = NodeGit.TreeEntry.FILEMODE;
911

1012
var reposPath = local("../repos/workdir/.git");
1113
var oid = "111dd657329797f6165f52f5085f61ac976dcf04";

test/tests/branch.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ var Promise = require("nodegit-promise");
44
var local = path.join.bind(path, __dirname);
55

66
describe("Branch", function() {
7-
var Repository = require(local("../../lib/repository"));
8-
var Branch = require(local("../../lib/branch"));
7+
var NodeGit = require(local("../../"));
8+
var Repository = NodeGit.Repository;
9+
var Branch = NodeGit.Branch;
910
var branchName = "test-branch";
1011
var fullBranchName = "refs/heads/" + branchName;
1112

test/tests/checkout.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ var path = require("path");
33
var local = path.join.bind(path, __dirname);
44

55
describe("Checkout", function() {
6-
var Repository = require(local("../../lib/repository"));
7-
var Checkout = require(local("../../lib/checkout"));
6+
var NodeGit = require(local("../../"));
7+
var Repository = NodeGit.Repository;
8+
var Checkout = NodeGit.Checkout;
89

910
var packageJsonOid = "0fa56e90e096a4c24c785206b826ab914ea3de1e";
1011
var reposPath = local("../repos/workdir/.git");

test/tests/clone.js

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ var fse = promisify(require("fs-extra"));
55
var local = path.join.bind(path, __dirname);
66

77
describe("Clone", function() {
8-
var Repository = require(local("../../lib/repository"));
9-
var clone = require(local("../../lib/clone"));
108
var NodeGit = require(local("../../"));
9+
var Repository = NodeGit.Repository;
10+
var Clone = NodeGit.Clone;
1111

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

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

32-
return clone(url, clonePath).then(function(repo) {
32+
return Clone(url, clonePath).then(function(repo) {
3333
assert.ok(repo instanceof Repository);
3434
test.repository = repo;
3535
});
@@ -46,7 +46,24 @@ describe("Clone", function() {
4646
}
4747
};
4848

49-
return clone(url, clonePath, opts).then(function(repo) {
49+
return Clone(url, clonePath, opts).then(function(repo) {
50+
assert.ok(repo instanceof Repository);
51+
test.repository = repo;
52+
});
53+
});
54+
55+
it("can clone using nested function", function() {
56+
var test = this;
57+
var url = "https://github.com/nodegit/test.git";
58+
var opts = {
59+
remoteCallbacks: {
60+
certificateCheck: function() {
61+
return 1;
62+
}
63+
}
64+
};
65+
66+
return Clone.clone(url, clonePath, opts).then(function(repo) {
5067
assert.ok(repo instanceof Repository);
5168
test.repository = repo;
5269
});
@@ -66,7 +83,7 @@ describe("Clone", function() {
6683
}
6784
};
6885

69-
return clone(url, clonePath, opts).then(function(repo) {
86+
return Clone(url, clonePath, opts).then(function(repo) {
7087
assert.ok(repo instanceof Repository);
7188
test.repository = repo;
7289
});
@@ -90,7 +107,7 @@ describe("Clone", function() {
90107
}
91108
};
92109

93-
return clone(url, clonePath, opts).then(function(repo) {
110+
return Clone(url, clonePath, opts).then(function(repo) {
94111
assert.ok(repo instanceof Repository);
95112
test.repository = repo;
96113
});
@@ -107,7 +124,7 @@ describe("Clone", function() {
107124
}
108125
};
109126

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

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

130-
return clone(url, clonePath, {
147+
return Clone(url, clonePath, {
131148
remoteCallbacks: {
132149
certificateCheck: function() {
133150
return 1;

test/tests/diff.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ var fse = promisify(require("fs-extra"));
66
var local = path.join.bind(path, __dirname);
77

88
describe("Diff", function() {
9-
var Repository = require(local("../../lib/repository"));
10-
var Diff = require(local("../../lib/diff"));
9+
var NodeGit = require(local("../../"));
10+
var Repository = NodeGit.Repository;
11+
var Diff = NodeGit.Diff;
1112

1213
var reposPath = local("../repos/workdir/.git");
1314
var oid = "fce88902e66c72b5b93e75bdb5ae717038b221f6";

test/tests/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ var writeFile = promisify(function(filename, data, callback) {
1010
});
1111

1212
describe("Index", function() {
13-
var Repository = require(local("../../lib/repository"));
14-
13+
var NodeGit = require(local("../../"));
14+
var Repository = NodeGit.Repository;
15+
1516
var reposPath = local("../repos/workdir/.git");
1617

1718
beforeEach(function() {

0 commit comments

Comments
 (0)