Skip to content

Commit 81673c9

Browse files
Matt BellMatt Bell
authored andcommitted
Updated to newest nodegit
1 parent c165775 commit 81673c9

File tree

3 files changed

+962
-9
lines changed

3 files changed

+962
-9
lines changed

index.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ function createRepo(image, opts, cb) {
6868
return cb('A repo already exists at path "' + opts.path + '"');
6969

7070
// create repo and a tree to commit to
71-
git.Repo.init(opts.path, false, function(err, repo) {
72-
if(err) return cb(err);
73-
repo.openIndex(function(err, index) {
74-
if(err) return cb(err);
71+
git.Repository.init(opts.path, 0).then(function(repo) {
72+
repo.index().then(function(index) {
7573
fs.writeFileSync(opts.path + '/' + README_PATH,
7674
'Generated with [Gitbanner](https://github.com/mappum/gitbanner).\r\n');
7775
index.addByPath(README_PATH, function(err) {
@@ -94,7 +92,7 @@ function createRepo(image, opts, cb) {
9492
if(i < nCommits) {
9593
var time = Math.floor(date.getTime() / 1000);
9694
var author = git.Signature.create(opts.author, opts.email, time, 0);
97-
var message = opts.message + ' - pixel:('+x+','+y+') - i:' + i;
95+
var message = opts.message + ' - pixel:('+x+','+y+') - i:' + i;
9896
var parent = [];
9997
if(lastCommit) parent[0] = lastCommit;
10098

@@ -128,8 +126,8 @@ function createRepo(image, opts, cb) {
128126
next(0, 0, 0);
129127
});
130128
})
131-
});
132-
});
129+
}).catch(function (err) { throw err });
130+
}).catch(function (err) { throw err });
133131
}
134132

135133
module.exports = {

0 commit comments

Comments
 (0)