Skip to content

Commit 4612652

Browse files
author
John Haley
committed
Fixed fetch example
1 parent 6dd55dd commit 4612652

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

example/fetch.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
var git = require('../'),
2-
path = require('path');
3-
4-
git.Repo.open(path.resolve(__dirname, '../.git'), function(error, repo) {
5-
if (error) throw error;
6-
7-
var remote = repo.getRemote("origin");
8-
remote.connect(0, function(error) {
9-
if (error) throw error;
10-
11-
remote.download(null, function(error) {
12-
if (error) throw error;
13-
14-
console.log("It worked!");
15-
})
16-
});
1+
var git = require('../');
2+
var path = require('path');
3+
4+
git.Repository.open(path.resolve(__dirname, '../.git'))
5+
.then(function(repo) {
6+
return git.Remote.load(repo, "origin");
7+
})
8+
.then(function(remote) {
9+
remote.connect(0);
10+
return remote.download();
11+
})
12+
.done(function() {
13+
console.log("It worked!");
1714
});

0 commit comments

Comments
 (0)