Merge pull request #161 from rohitner/master

Removed bug of ignored files
This commit is contained in:
Athitya Kumar 2017-11-23 03:46:26 +05:30 committed by GitHub
commit 60012c93d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 3 deletions

View file

@ -47,7 +47,7 @@ Metrics/ModuleLength:
Max: 200
Metrics/ClassLength:
Max: 300
Max: 350
Metrics/ParameterLists:
Max: 15

View file

@ -272,9 +272,24 @@ module ColorLS
Git.colored_status_symbols(@git_status[path], @colors)
end
def git_dir_info(path)
modes = @git_status.select { |file, _mode| file.start_with?(path) }.values
Dir.class_eval do
def self.deep_entries(path)
(Dir.entries(path) - ['.', '..']).map do |entry|
if Dir.exist?("#{path}/#{entry}")
Dir.deep_entries("#{path}/#{entry}")
else
entry
end
end.flatten
end
end
def git_dir_info(path)
ignored = @git_status.select { |file, mode| file.start_with?(path) && mode==' ' }.keys
present = Dir.deep_entries(path).map { |p| "#{path}/#{p}" }
return ' ' if (present-ignored).empty?
modes = (present-ignored).map { |file| @git_status[file] }-[nil]
return ' ✓ '.colorize(@colors[:unchanged]) if modes.empty?
Git.colored_status_symbols(modes.join.uniq, @colors)
end

View file

@ -10,6 +10,10 @@ module ColorLS
@git_status[file] = mode
end
`git ls-files --others -i --exclude-standard`.split("\n").each do |file|
@git_status[file] = ' '
end
Dir.chdir(actual)
@git_status
end