mirror of
https://github.com/atom/atom.git
synced 2026-01-29 16:58:20 -05:00
start spiking out async repo
This commit is contained in:
23
src/git-repository-async.js
Normal file
23
src/git-repository-async.js
Normal 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
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user