Class: CommandT::Scanner::FileScanner::GitFileScanner
- Inherits:
-
FindFileScanner
- Object
- CommandT::Scanner
- CommandT::Scanner::FileScanner
- FindFileScanner
- CommandT::Scanner::FileScanner::GitFileScanner
- Defined in:
- lib/command-t/scanner/file_scanner/git_file_scanner.rb
Overview
Uses git ls-files to scan for files
Constant Summary collapse
- LsFilesError =
Class.new(::RuntimeError)
Constants inherited from CommandT::Scanner::FileScanner
Instance Attribute Summary
Attributes inherited from CommandT::Scanner::FileScanner
Instance Method Summary collapse
Methods inherited from CommandT::Scanner::FileScanner
Methods inherited from CommandT::Scanner
Constructor Details
This class inherits a constructor from CommandT::Scanner::FileScanner
Instance Method Details
#paths! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/command-t/scanner/file_scanner/git_file_scanner.rb', line 11 def paths! Dir.chdir(@path) do command = %w[git ls-files --exclude-standard -cz] if @include_untracked command << %q(--others) end all_files = list_files(command) if @scan_submodules base = nil list_files(%w[ git submodule foreach --recursive git ls-files --exclude-standard -z ]).each do |path| if path =~ /\AEntering '(.*)'\n(.*)\z/ base = $~[1] path = $~[2] end all_files.push(base + File::SEPARATOR + path) end end filtered = all_files. map { |path| path.chomp }. reject { |path| path_excluded?(path, 0) } truncated = filtered.take(@max_files) if truncated.count < filtered.count show_max_files_warning end truncated.to_a end rescue LsFilesError super rescue Errno::ENOENT # git executable not present and executable super end |