diff --git a/spec/git-repository-async-spec.js b/spec/git-repository-async-spec.js index 039ed66e6..d9ffcd3db 100644 --- a/spec/git-repository-async-spec.js +++ b/spec/git-repository-async-spec.js @@ -568,6 +568,23 @@ describe('GitRepositoryAsync', () => { }) }) + describe('.isSubmodule(path)', () => { + beforeEach(() => { + const workingDirectory = copySubmoduleRepository() + repo = GitRepositoryAsync.open(workingDirectory) + }) + + it("returns false for a path that isn't a submodule", async () => { + const isSubmodule = await repo.isSubmodule('README') + expect(isSubmodule).toBe(false) + }) + + it('returns true for a path that is a submodule', async () => { + const isSubmodule = await repo.isSubmodule('jstips') + expect(isSubmodule).toBe(true) + }) + }) + describe('.getAheadBehindCount(reference, path)', () => { beforeEach(() => { const workingDirectory = copyRepository() diff --git a/src/git-repository-async.js b/src/git-repository-async.js index 060bb7133..1fa4a7203 100644 --- a/src/git-repository-async.js +++ b/src/git-repository-async.js @@ -252,8 +252,6 @@ export default class GitRepositoryAsync { .then(repo => repo.openIndex()) .then(index => Promise.all([index, this.relativizeToWorkingDirectory(_path)])) .then(([index, relativePath]) => { - // TODO: This'll probably be wrong if the submodule doesn't exist in the - // index yet? Is that a thing? const entry = index.getByPath(relativePath) if (!entry) return false @@ -894,8 +892,6 @@ export default class GitRepositoryAsync { // // Returns a {Promise} which will resolve to {null} when refresh is complete. refreshStatus () { - // TODO add submodule tracking - const status = this._refreshStatus() const branch = this._refreshBranch() const aheadBehind = branch.then(branchName => this._refreshAheadBehindCount(branchName))