mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Only require git if exluding ignored files
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
fs = require 'fs'
|
||||
_ = require 'underscore'
|
||||
Git = require 'git'
|
||||
|
||||
module.exports =
|
||||
loadPaths: (rootPath, ignoredNames, excludeGitIgnoredPaths) ->
|
||||
if excludeGitIgnoredPaths
|
||||
Git = require 'git'
|
||||
repo = Git.open(rootPath, refreshIndexOnFocus: false)
|
||||
|
||||
paths = []
|
||||
repo = Git.open(rootPath, refreshIndexOnFocus: false) if excludeGitIgnoredPaths
|
||||
isIgnored = (path) ->
|
||||
for segment in path.split('/')
|
||||
return true if _.contains(ignoredNames, segment)
|
||||
@@ -15,5 +17,7 @@ module.exports =
|
||||
onDirectory = (path) ->
|
||||
not isIgnored(path)
|
||||
fs.traverseTree(rootPath, onFile, onDirectory)
|
||||
|
||||
repo?.destroy()
|
||||
|
||||
callTaskMethod('pathsLoaded', paths)
|
||||
|
||||
Reference in New Issue
Block a user