From c2242e46c24def201b2a5d3eff26f429391543c1 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 23 Mar 2016 10:31:26 +0100 Subject: [PATCH 01/16] =?UTF-8?q?Read=20state=20from=20StorageFolder=20whe?= =?UTF-8?q?n=20it=20can=E2=80=99t=20be=20found=20in=20StateStore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spec/atom-environment-spec.coffee | 28 ++++++++++++++++++++++++++++ src/atom-environment.coffee | 11 ++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/spec/atom-environment-spec.coffee b/spec/atom-environment-spec.coffee index 3283b63d6..2ba0164e6 100644 --- a/spec/atom-environment-spec.coffee +++ b/spec/atom-environment-spec.coffee @@ -4,6 +4,7 @@ temp = require 'temp' Package = require '../src/package' ThemeManager = require '../src/theme-manager' AtomEnvironment = require '../src/atom-environment' +StorageFolder = require '../src/storage-folder' describe "AtomEnvironment", -> describe 'window sizing methods', -> @@ -179,6 +180,33 @@ describe "AtomEnvironment", -> atom.loadState().then (state) -> expect(state).toEqual({stuff: 'cool'}) + it "loads state from the storage folder when it can't be found in atom.stateStore", -> + jasmine.useRealClock() + + storageFolderState = {foo: 1, bar: 2} + serializedState = {someState: 42} + loadSettings = _.extend(atom.getLoadSettings(), {initialPaths: [temp.mkdirSync("project-directory")]}) + spyOn(atom, 'getLoadSettings').andReturn(loadSettings) + spyOn(atom, 'serialize').andReturn(serializedState) + spyOn(atom, 'getConfigDirPath').andReturn(temp.mkdirSync("config-directory")) + atom.project.setPaths(atom.getLoadSettings().initialPaths) + + waitsForPromise -> + atom.stateStore.connect() + + runs -> + storageFolder = new StorageFolder(atom.getConfigDirPath()) + storageFolder.storeSync(atom.getStateKey(loadSettings.initialPaths), storageFolderState) + + waitsForPromise -> + atom.loadState().then (state) -> expect(state).toEqual(storageFolderState) + + waitsForPromise -> + atom.saveState() + + waitsForPromise -> + atom.loadState().then (state) -> expect(state).toEqual(serializedState) + it "saves state on keydown, mousedown, and when the editor window unloads", -> spyOn(atom, 'saveState') diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index 8c79d66f6..a34065bbd 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -11,6 +11,7 @@ Model = require './model' WindowEventHandler = require './window-event-handler' StylesElement = require './styles-element' StateStore = require './state-store' +StorageFolder = require './storage-folder' {getWindowLoadSettings, setWindowLoadSettings} = require './window-load-settings-helpers' registerDefaultCommands = require './register-default-commands' @@ -853,7 +854,12 @@ class AtomEnvironment extends Model loadState: -> if @enablePersistence if stateKey = @getStateKey(@getLoadSettings().initialPaths) - @stateStore.load(stateKey) + @stateStore.load(stateKey).then (state) => + if state + state + else + # TODO: remove this when every user has migrated to the IndexedDb state store. + @getStorageFolder().load(stateKey) else @applicationDelegate.getTemporaryWindowState() else @@ -882,6 +888,9 @@ class AtomEnvironment extends Model else null + getStorageFolder: -> + @storageFolder ?= new StorageFolder(@getConfigDirPath()) + getConfigDirPath: -> @configDirPath ?= process.env.ATOM_HOME From 80146ae631411e0fd5d6d276c2c4a105c1c147ff Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 23 Mar 2016 10:52:34 +0100 Subject: [PATCH 02/16] Assign the supplied configDirPath to an instance variable --- src/atom-environment.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index a34065bbd..f4dc49060 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -128,7 +128,7 @@ class AtomEnvironment extends Model # Call .loadOrCreate instead constructor: (params={}) -> - {@blobStore, @applicationDelegate, @window, @document, configDirPath, @enablePersistence, onlyLoadBaseStyleSheets} = params + {@blobStore, @applicationDelegate, @window, @document, @configDirPath, @enablePersistence, onlyLoadBaseStyleSheets} = params @unloaded = false @loadTime = null @@ -148,10 +148,10 @@ class AtomEnvironment extends Model @notifications = new NotificationManager - @config = new Config({configDirPath, resourcePath, notificationManager: @notifications, @enablePersistence}) + @config = new Config({@configDirPath, resourcePath, notificationManager: @notifications, @enablePersistence}) @setConfigSchema() - @keymaps = new KeymapManager({configDirPath, resourcePath, notificationManager: @notifications}) + @keymaps = new KeymapManager({@configDirPath, resourcePath, notificationManager: @notifications}) @tooltips = new TooltipManager(keymapManager: @keymaps) @@ -160,16 +160,16 @@ class AtomEnvironment extends Model @grammars = new GrammarRegistry({@config}) - @styles = new StyleManager({configDirPath}) + @styles = new StyleManager({@configDirPath}) @packages = new PackageManager({ - devMode, configDirPath, resourcePath, safeMode, @config, styleManager: @styles, + devMode, @configDirPath, resourcePath, safeMode, @config, styleManager: @styles, commandRegistry: @commands, keymapManager: @keymaps, notificationManager: @notifications, grammarRegistry: @grammars, deserializerManager: @deserializers, viewRegistry: @views }) @themes = new ThemeManager({ - packageManager: @packages, configDirPath, resourcePath, safeMode, @config, + packageManager: @packages, @configDirPath, resourcePath, safeMode, @config, styleManager: @styles, notificationManager: @notifications, viewRegistry: @views }) From 25a4c4c293e61ca0971ff1f5a86af68f299c8cfe Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 23 Mar 2016 10:53:37 +0100 Subject: [PATCH 03/16] Clear StorageFolder when --clear-window-state is supplied --- src/atom-environment.coffee | 4 +++- src/storage-folder.coffee | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/atom-environment.coffee b/src/atom-environment.coffee index f4dc49060..6ef46dc2a 100644 --- a/src/atom-environment.coffee +++ b/src/atom-environment.coffee @@ -139,7 +139,9 @@ class AtomEnvironment extends Model @stateStore = new StateStore('AtomEnvironments', 1) - @stateStore.clear() if clearWindowState + if clearWindowState + @getStorageFolder().clear() + @stateStore.clear() @deserializers = new DeserializerManager(this) @deserializeTimings = {} diff --git a/src/storage-folder.coffee b/src/storage-folder.coffee index 06beae56a..327697672 100644 --- a/src/storage-folder.coffee +++ b/src/storage-folder.coffee @@ -6,6 +6,14 @@ class StorageFolder constructor: (containingPath) -> @path = path.join(containingPath, "storage") if containingPath? + clear: -> + return unless @path? + + try + fs.removeSync(@path) + catch error + console.warn "Error deleting #{statePath}", error.stack, error + storeSync: (name, object) -> return unless @path? From f69c5bdee436f44ac5b71f0761968a180570b726 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 23 Mar 2016 12:11:27 +0100 Subject: [PATCH 04/16] Oops. --- src/storage-folder.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage-folder.coffee b/src/storage-folder.coffee index 327697672..280eb8b5c 100644 --- a/src/storage-folder.coffee +++ b/src/storage-folder.coffee @@ -12,7 +12,7 @@ class StorageFolder try fs.removeSync(@path) catch error - console.warn "Error deleting #{statePath}", error.stack, error + console.warn "Error deleting #{@path}", error.stack, error storeSync: (name, object) -> return unless @path? From cbb911cde8652d7aff6c2a0080d7ca9e5bac7641 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Wed, 23 Mar 2016 13:43:54 +0100 Subject: [PATCH 05/16] :green_heart: --- spec/atom-environment-spec.coffee | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spec/atom-environment-spec.coffee b/spec/atom-environment-spec.coffee index 2ba0164e6..5fd4b11f1 100644 --- a/spec/atom-environment-spec.coffee +++ b/spec/atom-environment-spec.coffee @@ -173,7 +173,7 @@ describe "AtomEnvironment", -> waitsForPromise -> atom.saveState().then -> atom.loadState().then (state) -> - expect(state).toBeNull() + expect(state).toBeFalsy() waitsForPromise -> loadSettings.initialPaths = [dir2, dir1] @@ -188,15 +188,14 @@ describe "AtomEnvironment", -> loadSettings = _.extend(atom.getLoadSettings(), {initialPaths: [temp.mkdirSync("project-directory")]}) spyOn(atom, 'getLoadSettings').andReturn(loadSettings) spyOn(atom, 'serialize').andReturn(serializedState) - spyOn(atom, 'getConfigDirPath').andReturn(temp.mkdirSync("config-directory")) + spyOn(atom, 'getStorageFolder').andReturn(new StorageFolder(temp.mkdirSync("config-directory"))) atom.project.setPaths(atom.getLoadSettings().initialPaths) waitsForPromise -> atom.stateStore.connect() runs -> - storageFolder = new StorageFolder(atom.getConfigDirPath()) - storageFolder.storeSync(atom.getStateKey(loadSettings.initialPaths), storageFolderState) + atom.getStorageFolder().storeSync(atom.getStateKey(loadSettings.initialPaths), storageFolderState) waitsForPromise -> atom.loadState().then (state) -> expect(state).toEqual(storageFolderState) From 2f58c404726e7e8949a8263be58f1f811ad1b4e4 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 15:12:06 -0400 Subject: [PATCH 06/16] Pass subscriptions through to the async layer. --- src/git-repository.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 0513c2293..87fa488da 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -136,7 +136,7 @@ class GitRepository # # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. onDidDestroy: (callback) -> - @emitter.on 'did-destroy', callback + @async.onDidDestroy callback ### Section: Event Subscription @@ -154,7 +154,7 @@ class GitRepository # # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. onDidChangeStatus: (callback) -> - @emitter.on 'did-change-status', callback + @async.onDidChangeStatus callback # Public: Invoke the given callback when a multiple files' statuses have # changed. For example, on window focus, the status of all the paths in the @@ -165,7 +165,7 @@ class GitRepository # # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. onDidChangeStatuses: (callback) -> - @emitter.on 'did-change-statuses', callback + @async.onDidChangeStatuses callback ### Section: Repository Details From 3aae2054f7a88bc167384afe687a72013a4dc5dd Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 15:14:12 -0400 Subject: [PATCH 07/16] Grab status from the underlying async layer. --- src/git-repository.coffee | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 87fa488da..6547557d8 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -83,7 +83,6 @@ class GitRepository asyncOptions.subscribeToBuffers = false @async = GitRepositoryAsync.open(path, asyncOptions) - @statuses = {} @upstream = {ahead: 0, behind: 0} for submodulePath, submoduleRepo of @repo.submodules submoduleRepo.upstream = {ahead: 0, behind: 0} @@ -317,7 +316,7 @@ class GitRepository getDirectoryStatus: (directoryPath) -> directoryPath = "#{@relativize(directoryPath)}/" directoryStatus = 0 - for path, status of @statuses + for path, status of @async.getCachedPathStatuses() directoryStatus |= status if path.indexOf(directoryPath) is 0 directoryStatus @@ -333,15 +332,8 @@ class GitRepository repo = @getRepo(path) relativePath = @relativize(path) - currentPathStatus = @statuses[relativePath] ? 0 pathStatus = repo.getStatus(repo.relativize(path)) ? 0 pathStatus = 0 if repo.isStatusIgnored(pathStatus) - if pathStatus > 0 - @statuses[relativePath] = pathStatus - else - delete @statuses[relativePath] - if currentPathStatus isnt pathStatus - @emitter.emit 'did-change-status', {path, pathStatus} pathStatus @@ -351,7 +343,7 @@ class GitRepository # # Returns a status {Number} or null if the path is not in the cache. getCachedPathStatus: (path) -> - @statuses[@relativize(path)] + @async.getCachedPathStatuses()[@relativize(path)] # Public: Returns true if the given status indicates modification. # From 4ecc6aac90961ab8bd3c8211c0acecdc6428f2ee Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 15:14:32 -0400 Subject: [PATCH 08/16] Grab the branch from the async layer. --- src/git-repository.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 6547557d8..0e1d3980a 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -470,7 +470,9 @@ class GitRepository # # Returns a promise that resolves when the repository has been refreshed. refreshStatus: -> - asyncRefresh = @async.refreshStatus() + asyncRefresh = @async.refreshStatus().then => + @branch = @async.branch + syncRefresh = new Promise (resolve, reject) => @handlerPath ?= require.resolve('./repository-status-handler') @@ -487,7 +489,6 @@ class GitRepository @statuses = statuses @upstream = upstream - @branch = branch @submodules = submodules for submodulePath, submoduleRepo of @getRepo().submodules From c9ff5db064a4150701530cb959a7b20864524a42 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 15:15:10 -0400 Subject: [PATCH 09/16] Don't update status anymore in the sync layer. --- src/git-repository.coffee | 12 +----------- src/repository-status-handler.coffee | 19 +------------------ 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 0e1d3980a..a40ee69d1 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -476,18 +476,8 @@ class GitRepository syncRefresh = new Promise (resolve, reject) => @handlerPath ?= require.resolve('./repository-status-handler') - relativeProjectPaths = @project?.getPaths() - .map (path) => @relativize(path) - .map (path) -> if path.length > 0 then path + '/**' else '*' - @statusTask?.terminate() - @statusTask = Task.once @handlerPath, @getPath(), relativeProjectPaths, ({statuses, upstream, branch, submodules}) => - statusesUnchanged = _.isEqual(statuses, @statuses) and - _.isEqual(upstream, @upstream) and - _.isEqual(branch, @branch) and - _.isEqual(submodules, @submodules) - - @statuses = statuses + @statusTask = Task.once @handlerPath, @getPath(), ({upstream, submodules}) => @upstream = upstream @submodules = submodules diff --git a/src/repository-status-handler.coffee b/src/repository-status-handler.coffee index 2fda9a335..adae7bc4f 100644 --- a/src/repository-status-handler.coffee +++ b/src/repository-status-handler.coffee @@ -5,32 +5,15 @@ module.exports = (repoPath, paths = []) -> repo = Git.open(repoPath) upstream = {} - statuses = {} submodules = {} - branch = null if repo? - # Statuses in main repo - workingDirectoryPath = repo.getWorkingDirectory() - repoStatus = (if paths.length > 0 then repo.getStatusForPaths(paths) else repo.getStatus()) - for filePath, status of repoStatus - statuses[filePath] = status - - # Statuses in submodules for submodulePath, submoduleRepo of repo.submodules submodules[submodulePath] = branch: submoduleRepo.getHead() upstream: submoduleRepo.getAheadBehindCount() - workingDirectoryPath = submoduleRepo.getWorkingDirectory() - for filePath, status of submoduleRepo.getStatus() - absolutePath = path.join(workingDirectoryPath, filePath) - # Make path relative to parent repository - relativePath = repo.relativize(absolutePath) - statuses[relativePath] = status - upstream = repo.getAheadBehindCount() - branch = repo.getHead() repo.release() - {statuses, upstream, branch, submodules} + {upstream, submodules} From 380df728084035b6a05a9ed5ef211b45f917306d Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 15:15:24 -0400 Subject: [PATCH 10/16] All emissions will propagate out from the async layer. --- src/git-repository.coffee | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index a40ee69d1..6ab6f3e85 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -1,7 +1,7 @@ {basename, join} = require 'path' _ = require 'underscore-plus' -{Emitter, Disposable, CompositeDisposable} = require 'event-kit' +{Disposable, CompositeDisposable} = require 'event-kit' fs = require 'fs-plus' GitRepositoryAsync = require './git-repository-async' GitUtils = require 'git-utils' @@ -69,7 +69,6 @@ class GitRepository null constructor: (path, options={}) -> - @emitter = new Emitter @subscriptions = new CompositeDisposable @repo = GitUtils.open(path) @@ -107,11 +106,6 @@ class GitRepository # This destroys any tasks and subscriptions and releases the underlying # libgit2 repository handle. This method is idempotent. destroy: -> - if @emitter? - @emitter.emit 'did-destroy' - @emitter.dispose() - @emitter = null - if @statusTask? @statusTask.terminate() @statusTask = null @@ -486,7 +480,4 @@ class GitRepository resolve() - unless statusesUnchanged - @emitter.emit 'did-change-statuses' - return Promise.all([asyncRefresh, syncRefresh]) From f001c832632793ce5a0b7f9f8a2e7271bb43b1c3 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 15:26:18 -0400 Subject: [PATCH 11/16] Bring back some synchronous event emitting. Preserve the previous behavior of emitting synchronously with observed change. --- src/git-repository.coffee | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 6ab6f3e85..793efd08d 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -1,7 +1,7 @@ {basename, join} = require 'path' _ = require 'underscore-plus' -{Disposable, CompositeDisposable} = require 'event-kit' +{Emitter, Disposable, CompositeDisposable} = require 'event-kit' fs = require 'fs-plus' GitRepositoryAsync = require './git-repository-async' GitUtils = require 'git-utils' @@ -69,6 +69,7 @@ class GitRepository null constructor: (path, options={}) -> + @emitter = new Emitter @subscriptions = new CompositeDisposable @repo = GitUtils.open(path) @@ -86,6 +87,8 @@ class GitRepository for submodulePath, submoduleRepo of @repo.submodules submoduleRepo.upstream = {ahead: 0, behind: 0} + @statusesByPath = {} + {@project, @config, refreshOnWindowFocus} = options refreshOnWindowFocus ?= true @@ -106,6 +109,11 @@ class GitRepository # This destroys any tasks and subscriptions and releases the underlying # libgit2 repository handle. This method is idempotent. destroy: -> + if @emitter? + @emitter.emit 'did-destroy' + @emitter.dispose() + @emitter = null + if @statusTask? @statusTask.terminate() @statusTask = null @@ -129,7 +137,7 @@ class GitRepository # # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. onDidDestroy: (callback) -> - @async.onDidDestroy callback + @emitter.on 'did-destroy', callback ### Section: Event Subscription @@ -147,7 +155,7 @@ class GitRepository # # Returns a {Disposable} on which `.dispose()` can be called to unsubscribe. onDidChangeStatus: (callback) -> - @async.onDidChangeStatus callback + @emitter.on 'did-change-status', callback # Public: Invoke the given callback when a multiple files' statuses have # changed. For example, on window focus, the status of all the paths in the @@ -321,13 +329,22 @@ class GitRepository # Returns a {Number} representing the status. This value can be passed to # {::isStatusModified} or {::isStatusNew} to get more information. getPathStatus: (path) -> + repo = @getRepo(path) + relativePath = @relativize(path) + currentPathStatus = @statusesByPath[relativePath] ? @async.getCachedPathStatuses()[relativePath] ? 0 + # Trigger events emitted on the async repo as well @async.refreshStatusForPath(path) - repo = @getRepo(path) - relativePath = @relativize(path) pathStatus = repo.getStatus(repo.relativize(path)) ? 0 pathStatus = 0 if repo.isStatusIgnored(pathStatus) + if pathStatus > 0 + @statusesByPath[relativePath] = pathStatus + else + delete @statusesByPath[relativePath] + + if currentPathStatus isnt pathStatus + @emitter.emit 'did-change-status', {path, pathStatus} pathStatus @@ -465,6 +482,7 @@ class GitRepository # Returns a promise that resolves when the repository has been refreshed. refreshStatus: -> asyncRefresh = @async.refreshStatus().then => + @statusesByPath = {} @branch = @async.branch syncRefresh = new Promise (resolve, reject) => From fff1e8f3d1a3ef4b99f0625ec24f803412e4d788 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 15:36:44 -0400 Subject: [PATCH 12/16] Cache the results of calling getPathStatus so we're consistent across calls. --- src/git-repository.coffee | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 793efd08d..27f7d7b7d 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -318,7 +318,7 @@ class GitRepository getDirectoryStatus: (directoryPath) -> directoryPath = "#{@relativize(directoryPath)}/" directoryStatus = 0 - for path, status of @async.getCachedPathStatuses() + for path, status of _.extend({}, @async.getCachedPathStatuses(), @statusesByPath) directoryStatus |= status if path.indexOf(directoryPath) is 0 directoryStatus @@ -331,7 +331,16 @@ class GitRepository getPathStatus: (path) -> repo = @getRepo(path) relativePath = @relativize(path) - currentPathStatus = @statusesByPath[relativePath] ? @async.getCachedPathStatuses()[relativePath] ? 0 + + # This is a bit particular. If a package calls `getPathStatus` like this: + # - change the file + # - getPathStatus + # - change the file + # - getPathStatus + # We need to preserve the guarantee that each call to `getPathStatus` will + # synchronously emit 'did-change-status'. So we need to keep a cache of the + # statuses found from this call. + currentPathStatus = @getCachedRelativePathStatus(relativePath) ? 0 # Trigger events emitted on the async repo as well @async.refreshStatusForPath(path) @@ -354,7 +363,11 @@ class GitRepository # # Returns a status {Number} or null if the path is not in the cache. getCachedPathStatus: (path) -> - @async.getCachedPathStatuses()[@relativize(path)] + relativePath = @relativize(path) + @getCachedRelativePathStatus(relativePath) + + getCachedRelativePathStatus: (relativePath) -> + @statusesByPath[relativePath] ? @async.getCachedPathStatuses()[relativePath] # Public: Returns true if the given status indicates modification. # From 8ee1c3274ba9ee9f2ef9388ea0aa27ec5a9de4cd Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 17:13:06 -0400 Subject: [PATCH 13/16] Always update the cached status path. --- src/git-repository.coffee | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 27f7d7b7d..2821ea42f 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -347,10 +347,7 @@ class GitRepository pathStatus = repo.getStatus(repo.relativize(path)) ? 0 pathStatus = 0 if repo.isStatusIgnored(pathStatus) - if pathStatus > 0 - @statusesByPath[relativePath] = pathStatus - else - delete @statusesByPath[relativePath] + @statusesByPath[relativePath] = pathStatus if currentPathStatus isnt pathStatus @emitter.emit 'did-change-status', {path, pathStatus} From fdebbf12acd266600d6564eb2bdf1fa612e28643 Mon Sep 17 00:00:00 2001 From: joshaber Date: Fri, 25 Mar 2016 17:14:09 -0400 Subject: [PATCH 14/16] If we're been destroyed then we won't have an async anymore. --- src/git-repository.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/git-repository.coffee b/src/git-repository.coffee index 2821ea42f..30d99791d 100644 --- a/src/git-repository.coffee +++ b/src/git-repository.coffee @@ -493,7 +493,7 @@ class GitRepository refreshStatus: -> asyncRefresh = @async.refreshStatus().then => @statusesByPath = {} - @branch = @async.branch + @branch = @async?.branch syncRefresh = new Promise (resolve, reject) => @handlerPath ?= require.resolve('./repository-status-handler') From 5fc111a104e389959a94acd4cb6a31619e073814 Mon Sep 17 00:00:00 2001 From: Lee Dohm Date: Sat, 26 Mar 2016 15:50:07 -0700 Subject: [PATCH 15/16] :memo: Add standard global notation --- src/notification-manager.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/notification-manager.coffee b/src/notification-manager.coffee index 46c781c20..3d8b1895c 100644 --- a/src/notification-manager.coffee +++ b/src/notification-manager.coffee @@ -3,6 +3,9 @@ Notification = require '../src/notification' # Public: A notification manager used to create {Notification}s to be shown # to the user. +# +# An instance of this class is always available as the `atom.notifications` +# global. module.exports = class NotificationManager constructor: -> From 22665c24d1fd87e050b61d994b145941b79c2183 Mon Sep 17 00:00:00 2001 From: joshaber Date: Mon, 28 Mar 2016 13:38:25 -0400 Subject: [PATCH 16/16] :arrow_up: tree-view@0.203.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5a8b87319..c0d50aba4 100644 --- a/package.json +++ b/package.json @@ -112,7 +112,7 @@ "symbols-view": "0.112.0", "tabs": "0.92.0", "timecop": "0.33.1", - "tree-view": "0.203.2", + "tree-view": "0.203.3", "update-package-dependencies": "0.10.0", "welcome": "0.34.0", "whitespace": "0.32.2",