mirror of
https://github.com/atom/atom.git
synced 2026-02-06 12:44:59 -05:00
Make project's Git repository a window global
This allows it to operate independently of the project and mirror the availability of the root view and project.
This commit is contained in:
@@ -40,12 +40,11 @@ class FuzzyFinderView extends SelectList
|
||||
$$ ->
|
||||
@li =>
|
||||
typeClass = null
|
||||
repo = project.repo
|
||||
if repo?
|
||||
status = project.repo?.statuses[project.resolve(path)]
|
||||
if repo.isStatusNew(status)
|
||||
if git?
|
||||
status = git.statuses[project.resolve(path)]
|
||||
if git.isStatusNew(status)
|
||||
typeClass = 'new'
|
||||
else if repo.isStatusModified(status)
|
||||
else if git.isStatusModified(status)
|
||||
typeClass = 'modified'
|
||||
|
||||
unless typeClass
|
||||
|
||||
@@ -443,7 +443,7 @@ describe 'FuzzyFinder', ->
|
||||
it "displays the modified icon", ->
|
||||
editor.setText('modified')
|
||||
editor.save()
|
||||
project.repo?.getPathStatus(editor.getPath())
|
||||
git.getPathStatus(editor.getPath())
|
||||
|
||||
rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
|
||||
expect(finderView.find('.file.modified').length).toBe 1
|
||||
@@ -453,7 +453,7 @@ describe 'FuzzyFinder', ->
|
||||
describe "when a new file is shown in the list", ->
|
||||
it "displays the new icon", ->
|
||||
rootView.open('newsample.js')
|
||||
project.repo?.getPathStatus(editor.getPath())
|
||||
git.getPathStatus(editor.getPath())
|
||||
|
||||
rootView.trigger 'fuzzy-finder:toggle-buffer-finder'
|
||||
expect(finderView.find('.file.new').length).toBe 1
|
||||
|
||||
@@ -68,7 +68,7 @@ class StatusBarView extends View
|
||||
@branchArea.hide()
|
||||
return unless path
|
||||
|
||||
head = @buffer.getRepo()?.getShortHead() or ''
|
||||
head = git?.getShortHead() or ''
|
||||
@branchLabel.text(head)
|
||||
@branchArea.show() if head
|
||||
|
||||
@@ -78,8 +78,7 @@ class StatusBarView extends View
|
||||
return unless path
|
||||
|
||||
@gitStatusIcon.addClass('git-status octicons')
|
||||
git = @buffer.getRepo()
|
||||
return unless git
|
||||
return unless git?
|
||||
|
||||
status = git.getPathStatus(path)
|
||||
if git.isStatusModified(status)
|
||||
|
||||
@@ -22,22 +22,21 @@ class DirectoryView extends View
|
||||
@expand() if isExpanded
|
||||
@disclosureArrow.on 'click', => @toggleExpansion()
|
||||
|
||||
repo = @project.repo
|
||||
iconClass = 'directory-icon'
|
||||
if repo?
|
||||
if git?
|
||||
path = @directory.getPath()
|
||||
if parent
|
||||
@directoryName.addClass('ignored') if repo.isPathIgnored(path)
|
||||
iconClass = 'submodule-icon' if repo.isSubmodule(path)
|
||||
@directoryName.addClass('ignored') if git.isPathIgnored(path)
|
||||
iconClass = 'submodule-icon' if git.isSubmodule(path)
|
||||
else
|
||||
iconClass = 'repository-icon' if path is repo.getWorkingDirectory()
|
||||
iconClass = 'repository-icon' if path is git.getWorkingDirectory()
|
||||
@directoryName.addClass(iconClass)
|
||||
|
||||
getPath: ->
|
||||
@directory.path
|
||||
|
||||
isPathIgnored: (path) ->
|
||||
config.get("core.hideGitIgnoredFiles") and @project.repo?.isPathIgnored(path)
|
||||
config.get("core.hideGitIgnoredFiles") and git?.isPathIgnored(path)
|
||||
|
||||
buildEntries: ->
|
||||
@unwatchDescendantEntries()
|
||||
|
||||
@@ -34,17 +34,16 @@ class FileView extends View
|
||||
|
||||
updateStatus: ->
|
||||
@removeClass('ignored modified new')
|
||||
repo = @project.repo
|
||||
return unless repo?
|
||||
return unless git?
|
||||
|
||||
path = @getPath()
|
||||
if repo.isPathIgnored(path)
|
||||
if git.isPathIgnored(path)
|
||||
@addClass('ignored')
|
||||
else
|
||||
status = repo.getPathStatus(path)
|
||||
if repo.isStatusModified(status)
|
||||
status = git.getPathStatus(path)
|
||||
if git.isStatusModified(status)
|
||||
@addClass('modified')
|
||||
else if repo.isStatusNew(status)
|
||||
else if git.isStatusNew(status)
|
||||
@addClass('new')
|
||||
|
||||
getPath: ->
|
||||
|
||||
Reference in New Issue
Block a user