Skip to content

Commit 1f84d31

Browse files
committed
Revert "Merge pull request nodegit#615 from heavyk/thenify-bluebird"
This reverts commit afd030d, reversing changes made to 090096b.
1 parent 845ff31 commit 1f84d31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+147
-198
lines changed

examples/add-and-commit.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
var nodegit = require("../");
22
var path = require("path");
3-
var promisify = require("thenify-all");
4-
var fse = promisify(require("fs-extra"), ["ensureDir", "writeFile"]);
3+
var promisify = require("promisify-node");
4+
var fse = promisify(require("fs-extra"));
55
var fileName = "newfile.txt";
66
var fileContent = "hello world";
77
var directoryName = "salad/toast/strangerinastrangeland/theresnowaythisexists";
8+
// ensureDir is an alias to mkdirp, which has the callback with a weird name
9+
// and in the 3rd position of 4 (the 4th being used for recursion). We have to
10+
// force promisify it, because promisify-node won't detect it on its
11+
// own and assumes sync
12+
fse.ensureDir = promisify(fse.ensureDir);
813

914
/**
1015
* This example creates a certain file `newfile.txt`, adds it to the git
@@ -66,6 +71,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
6671

6772
return repo.createCommit("HEAD", author, committer, "message", oid, [parent]);
6873
})
69-
.then(function(commitId) {
74+
.done(function(commitId) {
7075
console.log("New Commit: ", commitId);
7176
});

examples/clone.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var nodegit = require("../");
2-
var promisify = require("thenify-all");
3-
var fse = promisify(require("fs-extra"), ["remove"]);
2+
var promisify = require("promisify-node");
3+
var fse = promisify(require("fs-extra"));
44
var path = "/tmp/nodegit-clone-demo";
55

66
fse.remove(path).then(function() {
@@ -28,7 +28,7 @@ fse.remove(path).then(function() {
2828
entry = entryResult;
2929
return entry.getBlob();
3030
})
31-
.then(function(blob) {
31+
.done(function(blob) {
3232
console.log(entry.filename(), entry.sha(), blob.rawsize() + "b");
3333
console.log("========================================================\n\n");
3434
var firstTenLines = blob.toString().split("\n").slice(0, 10).join("\n");

examples/cloneFromGithubWith2Factor.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var nodegit = require("../");
2-
var promisify = require("thenify-all");
3-
var fse = promisify(require("fs-extra"), ["remove"]);
2+
var promisify = require("promisify-node");
3+
var fse = promisify(require("fs-extra"));
44
var path = "/tmp/nodegit-github-2factor-demo";
55

66
var token = "{Your GitHub user token}";
@@ -35,7 +35,7 @@ var opts = {
3535

3636
fse.remove(path).then(function() {
3737
nodegit.Clone(repoUrl, path, opts)
38-
.then(function(repo) {
38+
.done(function(repo) {
3939
if (repo instanceof nodegit.Repository) {
4040
console.info("We cloned the repo!");
4141
}

examples/create-branch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
1313
repo.defaultSignature(),
1414
"Created new-branch on HEAD");
1515
});
16-
}).then(function() {
16+
}).done(function() {
1717
console.log("All done!");
1818
});

examples/create-new-repo.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
var nodegit = require("../");
22
var path = require("path");
3-
var promisify = require("thenify-all");
4-
var fse = promisify(require("fs-extra"), ["ensureDir", "writeFile"]);
3+
var promisify = require("promisify-node");
4+
var fse = promisify(require("fs-extra"));
55
var fileName = "newfile.txt";
66
var fileContent = "hello world";
77
var repoDir = "../../newRepo";
88

9+
fse.ensureDir = promisify(fse.ensureDir);
10+
911
var repository;
1012
var index;
1113

@@ -43,6 +45,6 @@ fse.ensureDir(path.resolve(__dirname, repoDir))
4345
// normal we don't get the head either, because there isn't one yet.
4446
return repository.createCommit("HEAD", author, committer, "message", oid, []);
4547
})
46-
.then(function(commitId) {
48+
.done(function(commitId) {
4749
console.log("New Commit: ", commitId);
4850
});

examples/details-for-tree-entry.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
2424
});
2525
});
2626
})
27-
.then(function() {
27+
.done(function() {
2828
console.log("Done!");
2929
});

examples/diff-commits.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
1818

1919
return commit.getDiff();
2020
})
21-
.then(function(diffList) {
21+
.done(function(diffList) {
2222
diffList.forEach(function(diff) {
2323
diff.patches().then(function(patches) {
2424
patches.forEach(function(patch) {

examples/fetch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
88
return nodegit.Cred.sshKeyFromAgent(userName);
99
}
1010
});
11-
}).then(function() {
11+
}).done(function() {
1212
console.log("It worked!");
1313
});

examples/general.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var nodegit = require("../");
22
var path = require("path");
3-
var Promise = require("bluebird");
3+
var Promise = require("nodegit-promise");
44
var oid;
55
var odb;
66
var repo;
@@ -362,6 +362,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
362362
return Promise.all(promises);
363363
})
364364

365-
.then(function() {
365+
.done(function() {
366366
console.log("Done!");
367367
});

examples/index-add-and-remove.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var nodegit = require("../");
22
var path = require("path");
3-
var Promise = require("bluebird");
4-
var promisify = require("thenify-all");
5-
var fse = promisify(require("fs-extra"), ["writeFile"]);
3+
var Promise = require("nodegit-promise");
4+
var promisify = require("promisify-node");
5+
var fse = promisify(require("fs-extra"));
66

77
nodegit.Repository.open(path.resolve(__dirname, "../.git"))
88
.then(function(repo) {
@@ -129,6 +129,6 @@ nodegit.Repository.open(path.resolve(__dirname, "../.git"))
129129
console.log("New files in index: " + newFiles.length);
130130
});
131131
});
132-
}).then(function() {
132+
}).done(function() {
133133
console.log("All done!");
134134
});

0 commit comments

Comments
 (0)