mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-19 05:31:23 +02:00
Correct git status for directories without changes
git does not report any status for empty directories, and it also does not report any status for directories without any modified, untracked or ignored files. To correctly show the status, we need to check whether the directory is empty if git did not report any status codes. When empty, show it as "not interesting", otherwise the "no changes" green check mark is shown. Note, I am specifically not using the untracked marker, as that would mean there is some interesting file inside the directory which could be added. Fixes #334.
This commit is contained in:
parent
d0244c2aa7
commit
fb39a9da6d
1 changed files with 6 additions and 4 deletions
|
@ -248,12 +248,14 @@ module ColorLS
|
|||
modes = if path == '.'
|
||||
Set.new(@git_status.values).flatten
|
||||
else
|
||||
@git_status.fetch(path, nil)
|
||||
@git_status[path]
|
||||
end
|
||||
|
||||
return Git.colored_status_symbols(modes, @colors) unless modes.nil?
|
||||
|
||||
' '
|
||||
if modes.empty? && Dir.empty?(File.join(@input, path))
|
||||
' '
|
||||
else
|
||||
Git.colored_status_symbols(modes, @colors)
|
||||
end
|
||||
end
|
||||
|
||||
def long_info(content)
|
||||
|
|
Loading…
Reference in a new issue