From 0c6235de71f03a78dfaaf4f9d9525b373f935765 Mon Sep 17 00:00:00 2001 From: joshaber Date: Wed, 10 Feb 2016 10:59:46 -0500 Subject: [PATCH 1/4] Add failing test. --- spec/git-spec.coffee | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/spec/git-spec.coffee b/spec/git-spec.coffee index cda2afaa8..b64b48e03 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,35 @@ 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 -> + filePath = path.join(subDir, 'b.txt') + status = repo.getCachedPathStatus(filePath) + expect(repo.isStatusModified(status)).toBe false + expect(repo.isStatusNew(status)).toBe false + describe "buffer events", -> [editor] = [] From c1a3535ab24d2b50e7ec29621d935c94d88a6980 Mon Sep 17 00:00:00 2001 From: joshaber Date: Wed, 10 Feb 2016 11:09:52 -0500 Subject: [PATCH 2/4] Don't need to repeat ourselves here. --- spec/git-spec.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/git-spec.coffee b/spec/git-spec.coffee index b64b48e03..e6b5d4df6 100644 --- a/spec/git-spec.coffee +++ b/spec/git-spec.coffee @@ -255,7 +255,6 @@ describe "GitRepository", -> statusHandler.callCount > 0 runs -> - filePath = path.join(subDir, 'b.txt') status = repo.getCachedPathStatus(filePath) expect(repo.isStatusModified(status)).toBe false expect(repo.isStatusNew(status)).toBe false From ea91588f878b08fcfbececb4ca1fbaac86ed99ef Mon Sep 17 00:00:00 2001 From: joshaber Date: Wed, 10 Feb 2016 14:19:44 -0500 Subject: [PATCH 3/4] :arrow_up: git-utils@4.1.2. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b96bb061..6e6bbec21 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", From 98a63d1d68b12eb2adafeb145ccfe2b62b28a659 Mon Sep 17 00:00:00 2001 From: joshaber Date: Wed, 10 Feb 2016 14:25:05 -0500 Subject: [PATCH 4/4] Glob it. --- src/git-repository.coffee | 1 + 1 file changed, 1 insertion(+) 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}) =>