start spiking out async repo

This commit is contained in:
Daniel Hengeveld
2015-10-15 15:54:42 +02:00
parent 51a035e31d
commit 8e744502fa
2 changed files with 326 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
"use babel";
const Git = require('nodegit')
module.exports = class GitRepositoryAsync {
static open(path) {
// QUESTION: Should this wrap Git.Repository and reject with a nicer message?
return new GitRepositoryAsync(Git.Repository.open(path))
}
constructor (openPromise) {
this.repo = null
// this could be replaced with a function
this._opening = true
openPromise.then( (repo) => {
this.repo = repo
this._opening = false
}).catch( (e) => {
this._opening = false
})
}
}