diff --git a/lib/directory-view.coffee b/lib/directory-view.coffee index ad1a8501..d191598a 100644 --- a/lib/directory-view.coffee +++ b/lib/directory-view.coffee @@ -58,8 +58,9 @@ class DirectoryView extends HTMLElement @expand() if @directory.expansionState.isExpanded updateStatus: -> - @classList.remove('status-ignored', 'status-modified', 'status-added') + @classList.remove('status-ignored', 'status-modified', 'status-added', 'status-unstaged') @classList.add("status-#{@directory.status}") if @directory.status? + @classList.add("status-unstaged") if @directory.staged is false subscribeToDirectory: -> @subscriptions.add @directory.onDidAddEntries (addedEntries) => diff --git a/lib/directory.coffee b/lib/directory.coffee index 7bf59762..22c181ff 100644 --- a/lib/directory.coffee +++ b/lib/directory.coffee @@ -88,6 +88,7 @@ class Directory return unless repo? newStatus = null + newStaged = null if repo.isPathIgnored(@path) newStatus = 'ignored' else @@ -97,8 +98,15 @@ class Directory else if repo.isStatusNew(status) newStatus = 'added' - if newStatus isnt @status + try + newStaged = repo.isStatusStaged(status) unless not status + catch error + # While git doesn’t expose isStatusStaged method + newStaged = (status & 15) > 0 unless not status + + if newStatus isnt @status or newStaged isnt @staged @status = newStatus + @staged = newStaged @emitter.emit('did-status-change', newStatus) # Is the given path ignored? diff --git a/lib/file-view.coffee b/lib/file-view.coffee index f4ec1f1e..eb94d553 100644 --- a/lib/file-view.coffee +++ b/lib/file-view.coffee @@ -29,8 +29,9 @@ class FileView extends HTMLElement @updateStatus() updateStatus: -> - @classList.remove('status-ignored', 'status-modified', 'status-added') + @classList.remove('status-ignored', 'status-modified', 'status-added', 'status-unstaged') @classList.add("status-#{@file.status}") if @file.status? + @classList.add("status-unstaged") if @file.staged is false getPath: -> @fileName.dataset.path diff --git a/lib/file.coffee b/lib/file.coffee index 902c4380..d223cd57 100644 --- a/lib/file.coffee +++ b/lib/file.coffee @@ -52,6 +52,7 @@ class File return unless repo? newStatus = null + newStaged = null if repo.isPathIgnored(@path) newStatus = 'ignored' else @@ -61,8 +62,15 @@ class File else if repo.isStatusNew(status) newStatus = 'added' - if newStatus isnt @status + try + newStaged = repo.isStatusStaged(status) unless not status + catch error + # While git doesn’t expose isStatusStaged method + newStaged = (status & 15) > 0 unless not status + + if newStatus isnt @status or newStaged isnt @staged @status = newStatus + @staged = newStaged @emitter.emit('did-status-change', newStatus) isPathEqual: (pathToCompare) -> diff --git a/styles/tree-view.less b/styles/tree-view.less index 7bdf6e5b..697698e3 100644 --- a/styles/tree-view.less +++ b/styles/tree-view.less @@ -93,3 +93,9 @@ } } } + +.status-unstaged { + & > div, & > span { + font-weight: bold; + } +}