Skip to content

Commit 00ee393

Browse files
committed
All tests passing in Windows.
1 parent 1531718 commit 00ee393

File tree

4 files changed

+35
-38
lines changed

4 files changed

+35
-38
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
/build/*
22
!/build/codegen/
3-
/node_modules/
4-
/vendor/libgit2/
3+
54
/doc/*
65
!/doc/Theme.css
7-
/test/.reposCache
6+
7+
/node_modules/
8+
/vendor/libgit2/
9+
/test/repos/

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"nodeunit": "~0.8.6",
4646
"rimraf": "~2.2.6",
4747
"ejs": "~1.0.0",
48-
"ncp": "~0.5.0",
4948
"async": "~0.2.10"
5049
},
5150
"scripts": {

test/nodegit.js

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,40 @@
11
var fs = require('fs');
22
var rimraf = require('rimraf');
3-
var ncp = require('ncp').ncp;
43
var exec = require('child_process').exec;
54
var path = require('path');
65
var async = require('async');
76

87
var testFiles = ['blob','difflist','oid','repo','tree_entry','commit','reference','revwalk','tree'];
98

109
function setupReposCache(cb) {
11-
fs.mkdir('.reposCache',function() {
12-
async.series([
13-
function empty(cb) { exec('git init .reposCache/empty',cb); },
14-
function workdir(cb) { exec('git clone https://github.com/nodegit/nodegit.git .reposCache/workdir',cb); },
15-
function nonrepo(cb) {
16-
fs.mkdir('.reposCache/nonrepo',function() {
17-
fs.writeFile('.reposCache/nonrepo/file.txt','This is a bogus file',cb);
18-
});
19-
}
20-
],cb);
21-
});
10+
fs.mkdir('repos',function() {
11+
async.series([
12+
function empty(cb) { exec('git init repos/empty',function() { cb(); }); },
13+
function workdir(cb) { exec('git clone https://github.com/nodegit/nodegit.git repos/workdir',function() { cb(); }); },
14+
function nonrepo(cb) {
15+
fs.mkdir('repos/nonrepo',function() {
16+
fs.writeFile('repos/nonrepo/file.txt','This is a bogus file',function() {
17+
cb();
18+
});
19+
});
20+
}
21+
],function() {
22+
cb();
23+
});
24+
});
2225
}
2326

24-
module.exports = {
25-
setUp: function(cb) {
26-
fs.exists('.reposCache',function(exists) {
27-
if (exists) {
28-
ncp('.reposCache','repos',cb);
29-
} else {
30-
setupReposCache(function(err) {
31-
if (err) { return cb(err); }
32-
ncp('.reposCache','repos',cb);
33-
});
34-
}
35-
});
36-
},
37-
tearDown: function(cb) {
38-
rimraf('repos',cb);
39-
}
27+
exports.setUp = function(cb) {
28+
fs.exists('.reposCache', function(exists) {
29+
if (!exists) {
30+
setupReposCache(function(err) {
31+
cb();
32+
});
33+
}
34+
});
4035
};
4136

42-
for(var i in testFiles) {
43-
var testFile = testFiles[i];
44-
module.exports[testFile] = require('./'+testFile);
45-
}
37+
Object.keys(testFiles).forEach(function(fileName) {
38+
var testFile = testFiles[fileName]
39+
exports[testFile] = require('./' + testFile);
40+
});

test/tree.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
var git = require('../'),
22
rimraf = require('rimraf'),
3-
fs = require('fs');
3+
fs = require('fs'),
4+
path = require('path');
45

56
var sha = '5716e9757886eaf38d51c86b192258c960d9cfea';
67
var fileCount = 512; // Number of blob & blob executabless
@@ -36,7 +37,7 @@ exports.insert = function(test) {
3637
buffer = new Buffer(text);
3738
repo.createBlobFromBuffer(buffer, function(error, blobId) {
3839
var builder = tree.builder();
39-
builder.insert("lib/baz/bar.txt", blobId, git.TreeEntry.FileMode.Blob);
40+
builder.insert(path.join("lib", "baz", "bar.txt"), blobId, git.TreeEntry.FileMode.Blob);
4041
builder.write(function(error, treeId) {
4142
repo.getTree(treeId, function(error, tree) {
4243
var author = git.Signature.create("Scott Chacon", "schacon@gmail.com", 123456789, 60),

0 commit comments

Comments
 (0)