mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-19 05:31:23 +02:00
Merge pull request #161 from rohitner/master
Removed bug of ignored files
This commit is contained in:
commit
60012c93d9
3 changed files with 22 additions and 3 deletions
|
@ -47,7 +47,7 @@ Metrics/ModuleLength:
|
|||
Max: 200
|
||||
|
||||
Metrics/ClassLength:
|
||||
Max: 300
|
||||
Max: 350
|
||||
|
||||
Metrics/ParameterLists:
|
||||
Max: 15
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue