forked from nodegit/nodegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunner.js
More file actions
37 lines (29 loc) · 1.09 KB
/
Copy pathrunner.js
File metadata and controls
37 lines (29 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var promisify = require("promisify-node");
var fse = promisify("fs-extra");
// Have to wrap exec, since it has a weird callback signature.
var exec = promisify(function(command, opts, callback) {
return require("child_process").exec(command, opts, callback);
});
before(function(done) {
this.timeout(350000);
var url = "https://github.com/nodegit/test";
var done = done.bind(null, null);
function initEmpty() {
return exec("git init test/repos/empty");
}
fse.removeSync("test/repos")
fse.mkdir("test/repos").then(initEmpty, initEmpty)
.then(function() {
return exec("git clone " + url + " test/repos/workdir");
}).then(function() {
return exec("git checkout rev-walk", {cwd: "test/repos/workdir"})
}).then(function() {
return exec("git checkout master", {cwd: "test/repos/workdir"})
}).then(function() {
var nonrepo = "test/repos/nonrepo";
function writeBogus() {
return fse.writeFile(nonrepo + "/file.txt", "This is a bogus file");
}
return fse.mkdir(nonrepo).then(writeBogus, writeBogus);
}).then(done, done);
});