And that's why we write tests.

This commit is contained in:
joshaber
2015-12-10 20:00:37 -05:00
parent 35768f8595
commit 81d4f06802
2 changed files with 30 additions and 11 deletions

View File

@@ -143,13 +143,13 @@ export default class GitRepositoryAsync {
isProjectAtRoot () {
if (!this.project) return Promise.resolve(false)
if (this.projectAtRoot) {
return this.projectAtRoot
} else {
this.projectAtRoot = Promise.resolve(() => {
return this.repoPromise.then(repo => this.project.relativize(repo.workdir()))
})
if (!this.projectAtRoot) {
this.projectAtRoot = this.repoPromise
.then(repo => this.project.relativize(repo.workdir()))
.then(relativePath => relativePath === '')
}
return this.projectAtRoot
}
// Public: Makes a path relative to the repository's working directory.