mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Merge pull request #12346 from atom/ns-fix-repository-status-updates
Avoid passing paths outside of repository to git status subprocesses
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
_ = require 'underscore-plus'
|
||||
{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
|
||||
fs = require 'fs-plus'
|
||||
path = require 'path'
|
||||
GitUtils = require 'git-utils'
|
||||
|
||||
Task = require './task'
|
||||
@@ -309,8 +310,8 @@ class GitRepository
|
||||
getDirectoryStatus: (directoryPath) ->
|
||||
directoryPath = "#{@relativize(directoryPath)}/"
|
||||
directoryStatus = 0
|
||||
for path, status of @statuses
|
||||
directoryStatus |= status if path.indexOf(directoryPath) is 0
|
||||
for statusPath, status of @statuses
|
||||
directoryStatus |= status if statusPath.indexOf(directoryPath) is 0
|
||||
directoryStatus
|
||||
|
||||
# Public: Get the status of a single path in the repository.
|
||||
@@ -432,8 +433,8 @@ class GitRepository
|
||||
# Subscribes to buffer events.
|
||||
subscribeToBuffer: (buffer) ->
|
||||
getBufferPathStatus = =>
|
||||
if path = buffer.getPath()
|
||||
@getPathStatus(path)
|
||||
if bufferPath = buffer.getPath()
|
||||
@getPathStatus(bufferPath)
|
||||
|
||||
bufferSubscriptions = new CompositeDisposable
|
||||
bufferSubscriptions.add buffer.onDidSave(getBufferPathStatus)
|
||||
@@ -468,8 +469,8 @@ class GitRepository
|
||||
@handlerPath ?= require.resolve('./repository-status-handler')
|
||||
|
||||
relativeProjectPaths = @project?.getPaths()
|
||||
.map (path) => @relativize(path)
|
||||
.filter (path) -> path.length > 0
|
||||
.map (projectPath) => @relativize(projectPath)
|
||||
.filter (projectPath) -> projectPath.length > 0 and not path.isAbsolute(projectPath)
|
||||
|
||||
@statusTask?.terminate()
|
||||
new Promise (resolve) =>
|
||||
|
||||
Reference in New Issue
Block a user