@@ -68,10 +68,8 @@ function createRepo(image, opts, cb) {
68
68
return cb ( 'A repo already exists at path "' + opts . path + '"' ) ;
69
69
70
70
// 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 ) {
75
73
fs . writeFileSync ( opts . path + '/' + README_PATH ,
76
74
'Generated with [Gitbanner](https://github.com/mappum/gitbanner).\r\n' ) ;
77
75
index . addByPath ( README_PATH , function ( err ) {
@@ -94,7 +92,7 @@ function createRepo(image, opts, cb) {
94
92
if ( i < nCommits ) {
95
93
var time = Math . floor ( date . getTime ( ) / 1000 ) ;
96
94
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 ;
98
96
var parent = [ ] ;
99
97
if ( lastCommit ) parent [ 0 ] = lastCommit ;
100
98
@@ -128,8 +126,8 @@ function createRepo(image, opts, cb) {
128
126
next ( 0 , 0 , 0 ) ;
129
127
} ) ;
130
128
} )
131
- } ) ;
132
- } ) ;
129
+ } ) . catch ( function ( err ) { throw err } ) ;
130
+ } ) . catch ( function ( err ) { throw err } ) ;
133
131
}
134
132
135
133
module . exports = {
0 commit comments