FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge master and fix diff tests. · nodegit/nodegit@51ee736 · GitHub

Repository navigation

Commit 51ee736

Browse files
committed
Merge master and fix diff tests.
2 parents 2124a7b + 26406c1 commit 51ee736

29 files changed

Lines changed: 661 additions & 669 deletions

‎generate/combyne/partials/callback_helpers.cc‎

Lines changed: 0 additions & 148 deletions
This file was deleted.

‎generate/templates/partials/callback_helpers.cc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
baton->{{ arg.name }} = {{ arg.name }};
1313
{% endeach %}
1414

15+
baton->result = 0;
1516
baton->req.data = baton;
1617
baton->done = false;
1718

‎package.json‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,24 +54,24 @@
5454
"node-pre-gyp"
5555
],
5656
"dependencies": {
57-
"fs-extra": "~0.15.0",
57+
"fs-extra": "^0.15.0",
5858
"node-pre-gyp": "~0.6.1",
5959
"nodegit-promise": "~1.0.0",
6060
"npm": "^2.1.18",
6161
"promisify-node": "~0.1.2",
6262
"which-native-nodish": "^1.0.3"
6363
},
6464
"devDependencies": {
65-
"mocha": "~2.1.0",
6665
"combyne": "~0.6.2",
6766
"istanbul": "~0.3.2",
6867
"js-beautify": "^1.5.4",
69-
"jshint": "~2.5.6",
68+
"jshint": "^2.6.0",
7069
"lodash": "^2.4.1",
71-
"nan": "~1.5.0",
70+
"mocha": "~2.1.0",
71+
"nan": "^1.6.2",
7272
"node-gyp": "~1.0.2",
7373
"nw-gyp": "^0.12.4",
74-
"request": "~2.51.0",
74+
"request": "^2.53.0",
7575
"tar": "~1.0.1"
7676
},
7777
"binary": {
@@ -85,19 +85,14 @@
8585
"mocha": "mocha test/runner test/tests",
8686
"mochaDebug": "mocha --debug-brk test/runner test/tests",
8787
"test": "npm run lint && npm run cov",
88-
8988
"generateJson": "node generate/scripts/generateJson",
9089
"generateNativeCode": "node generate/scripts/generateNativeCode",
9190
"generateMissingTests": "node generate/scripts/generateMissingTests",
92-
93-
9491
"prepublish": "node lifecycleScripts/prepareForBuild.js",
9592
"publish": "node-pre-gyp package && node-pre-gyp publish",
96-
9793
"install": "node lifecycleScripts/install",
9894
"installDebug": "BUILD_DEBUG=true npm install",
9995
"postinstall": "node lifecycleScripts/clean",
100-
10196
"recompile": "node-gyp configure build",
10297
"rebuild": "node generate && node-gyp configure build",
10398
"recompileDebug": "node-gyp configure --debug build",

‎test/index.js‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
1+
var fork = require("child_process").fork;
2+
var path = require("path");
3+
var local = path.join.bind(path, __dirname);
4+
15
var args = [
2-
"cover",
3-
process.platform != "win32" ? "_mocha" : "../node_modules/mocha/bin/_mocha",
4-
"--",
5-
"runner",
6-
"tests",
7-
"--report=lcov",
8-
"--expose-gc"
9-
];
6+
"cover",
7+
process.platform != "win32" ?
8+
"_mocha" :
9+
local("../node_modules/mocha/bin/_mocha"),
10+
"--",
11+
"runner",
12+
"tests",
13+
"--report=lcov",
14+
"--expose-gc"
15+
];
1016

11-
require("child_process").fork("../node_modules/istanbul/lib/cli.js", args, {
17+
fork(local("../node_modules/istanbul/lib/cli.js"), args, {
1218
cwd: __dirname
1319
}).on("close", function(code) {
1420
process.exit(code);

‎test/runner.js‎

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,47 @@
11
var promisify = require("promisify-node");
22
var fse = promisify("fs-extra");
3+
var path = require("path");
4+
var local = path.join.bind(path, __dirname);
35

46
// Have to wrap exec, since it has a weird callback signature.
57
var exec = promisify(function(command, opts, callback) {
68
return require("child_process").exec(command, opts, callback);
79
});
810

9-
before(function(done) {
11+
var workdirPath = local("repos/workdir");
12+
13+
before(function() {
1014
this.timeout(350000);
1115

1216
var url = "https://github.com/nodegit/test";
13-
var done = done.bind(null, null);
14-
15-
function initEmpty() {
16-
return exec("git init test/repos/empty");
17-
}
18-
19-
fse.removeSync("test/repos")
20-
21-
fse.mkdir("test/repos").then(initEmpty, initEmpty)
22-
.then(function() {
23-
return exec("git clone " + url + " test/repos/workdir");
24-
}).then(function() {
25-
return exec("git checkout rev-walk", {cwd: "test/repos/workdir"})
26-
}).then(function() {
27-
return exec("git checkout master", {cwd: "test/repos/workdir"})
28-
}).then(function() {
29-
var nonrepo = "test/repos/nonrepo";
30-
31-
function writeBogus() {
32-
return fse.writeFile(nonrepo + "/file.txt", "This is a bogus file");
33-
}
17+
return fse.remove(local("repos"))
18+
.then(function() {
19+
fse.mkdir(local("repos"));
20+
})
21+
.then(function() {
22+
return exec("git init " + local("repos", "empty"));
23+
})
24+
.then(function() {
25+
return exec("git clone " + url + " " + workdirPath);
26+
})
27+
.then(function() {
28+
return exec("git checkout rev-walk", {cwd: workdirPath});
29+
})
30+
.then(function() {
31+
return exec("git checkout master", {cwd: workdirPath});
32+
})
33+
.then(function() {
34+
return fse.mkdir(local("repos", "nonrepo"));
35+
})
36+
.then(function() {
37+
return fse.writeFile(local("repos", "nonrepo", "file.txt"),
38+
"This is a bogus file");
39+
});
40+
});
3441

35-
return fse.mkdir(nonrepo).then(writeBogus, writeBogus);
36-
}).then(done, done);
42+
beforeEach(function() {
43+
return exec("git clean -xdf", {cwd: workdirPath})
44+
.then(function() {
45+
return exec("git reset --hard", {cwd: workdirPath});
46+
});
3747
});

‎test/tests/attr.js‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
var assert = require("assert");
22
var path = require("path");
3+
var local = path.join.bind(path, __dirname);
34

45
describe("Attr", function() {
5-
var reposPath = path.resolve("test/repos/workdir/.git");
6+
var Repository = require(local("../../lib/repository"));
7+
var Attr = require(local("../../lib/attr"));
8+
var Status = require(local("../../lib/status"));
69

7-
var Repository = require("../../lib/repository");
8-
var Attr = require("../../lib/attr");
9-
var Status = require("../../lib/status");
10+
var reposPath = local("../repos/workdir/.git");
1011

1112
before(function() {
1213
var test = this;
1314

14-
return Repository.open(reposPath).then(function(repository) {
15-
test.repository = repository;
16-
});
15+
return Repository.open(reposPath)
16+
.then(function(repository) {
17+
test.repository = repository;
18+
});
1719
});
1820

1921
it("can add a macro definition", function() {

‎test/tests/blob.js‎

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
var assert = require("assert");
22
var path = require("path");
3+
var local = path.join.bind(path, __dirname);
34

45
describe("Blob", function() {
5-
var reposPath = path.resolve("test/repos/workdir/.git");
6-
var oid = "111dd657329797f6165f52f5085f61ac976dcf04";
6+
var Oid = require(local("../../lib/oid"));
7+
var Repository = require(local("../../lib/repository"));
8+
var FileMode = require(local("../../lib/tree_entry")).FILEMODE;
79

8-
var Oid = require("../../lib/oid");
9-
var Repository = require("../../lib/repository");
10-
var FileMode = require("../../lib/tree_entry").FILEMODE;
10+
var reposPath = local("../repos/workdir/.git");
11+
var oid = "111dd657329797f6165f52f5085f61ac976dcf04";
1112

1213
before(function() {
1314
var test = this;
1415

15-
return Repository.open(reposPath).then(function(repository) {
16-
test.repository = repository;
16+
return Repository.open(reposPath)
17+
.then(function(repository) {
18+
test.repository = repository;
1719

18-
return repository.getBlob(oid).then(function(blob) {
20+
return repository.getBlob(oid);
21+
})
22+
.then(function(blob) {
1923
test.blob = blob;
2024
});
21-
});
2225
});
2326

2427
it("can provide content as a buffer", function() {
@@ -40,8 +43,9 @@ describe("Blob", function() {
4043

4144
it("can get a blob with an Oid object", function() {
4245
var oidObject = Oid.fromString(oid);
43-
this.repository.getBlob(oidObject).then(function(blob) {
44-
assert.equal(this.blob.id().toString(), oid);
45-
});
46+
return this.repository.getBlob(oidObject)
47+
.then(function(blob) {
48+
assert.equal(blob.id().toString(), oid);
49+
});
4650
});
4751
});

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL