diff --git a/package.json b/package.json index d466f7920..cad9c051e 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "fs-plus": "^2.8.0", "fstream": "0.1.24", "fuzzaldrin": "^2.1", - "git-utils": "^4.1.0", + "git-utils": "^4.1.2", "grim": "1.5.0", "jasmine-json": "~0.0", "jasmine-tagged": "^1.1.4", diff --git a/spec/git-spec.coffee b/spec/git-spec.coffee index cda2afaa8..e6b5d4df6 100644 --- a/spec/git-spec.coffee +++ b/spec/git-spec.coffee @@ -205,7 +205,7 @@ describe "GitRepository", -> expect(repo.isStatusModified(repo.getDirectoryStatus(directoryPath))).toBe true describe ".refreshStatus()", -> - [newPath, modifiedPath, cleanPath, originalModifiedPathText] = [] + [newPath, modifiedPath, cleanPath, originalModifiedPathText, workingDirectory] = [] beforeEach -> workingDirectory = copyRepository() @@ -231,6 +231,34 @@ describe "GitRepository", -> expect(repo.isStatusNew(repo.getCachedPathStatus(newPath))).toBeTruthy() expect(repo.isStatusModified(repo.getCachedPathStatus(modifiedPath))).toBeTruthy() + it 'caches the proper statuses when a subdir is open', -> + subDir = path.join(workingDirectory, 'dir') + fs.mkdirSync(subDir) + + filePath = path.join(subDir, 'b.txt') + fs.writeFileSync(filePath, '') + + atom.project.setPaths([subDir]) + + waitsForPromise -> + atom.workspace.open('b.txt') + + statusHandler = null + runs -> + repo = atom.project.getRepositories()[0] + + statusHandler = jasmine.createSpy('statusHandler') + repo.onDidChangeStatuses statusHandler + repo.refreshStatus() + + waitsFor -> + statusHandler.callCount > 0 + + runs -> + status = repo.getCachedPathStatus(filePath) + expect(repo.isStatusModified(status)).toBe false + expect(repo.isStatusNew(status)).toBe false + describe "buffer events", -> [editor] = [] diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 2fdcd790a..44b86a433 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -485,6 +485,7 @@ class GitRepository relativeProjectPaths = @project?.getPaths() .map (path) => @relativize(path) .filter (path) -> path.length > 0 + .map (path) -> path + '/**' @statusTask?.terminate() @statusTask = Task.once @handlerPath, @getPath(), relativeProjectPaths, ({statuses, upstream, branch, submodules}) =>