mirror of
https://github.com/atom/atom.git
synced 2026-02-14 08:35:11 -05:00
Only compute Git status flags once
Previously the status was fetched twice, once for if modified and once for if new. Now the flags are fetched once and Git now provides helpers to check the status flags directly for modified and new status.
This commit is contained in:
@@ -36,19 +36,25 @@ class Git
|
||||
isPathIgnored: (path) ->
|
||||
@repo.isIgnored(@relativize(path))
|
||||
|
||||
isPathModified: (path) ->
|
||||
isStatusModified: (status) ->
|
||||
modifiedFlags = @statusFlags.working_dir_modified |
|
||||
@statusFlags.working_dir_delete |
|
||||
@statusFlags.working_dir_typechange |
|
||||
@statusFlags.index_modified |
|
||||
@statusFlags.index_deleted |
|
||||
@statusFlags.index_typechange
|
||||
(@getPathStatus(path) & modifiedFlags) > 0
|
||||
(status & modifiedFlags) > 0
|
||||
|
||||
isPathNew: (path) ->
|
||||
isPathModified: (path) ->
|
||||
@isStatusModified(@getPathStatus(path))
|
||||
|
||||
isStatusNew: (status) ->
|
||||
newFlags = @statusFlags.working_dir_new |
|
||||
@statusFlags.index_new
|
||||
(@getPathStatus(path) & newFlags) > 0
|
||||
(status & newFlags) > 0
|
||||
|
||||
isPathNew: (path) ->
|
||||
@isStatusNew(@getPathStatus(path))
|
||||
|
||||
relativize: (path) ->
|
||||
workingDirectory = @getWorkingDirectory()
|
||||
|
||||
Reference in New Issue
Block a user