Skip to content

Commit

Permalink
Fix git processing (#337)
Browse files Browse the repository at this point in the history
Fix regression in 1.3.x where git status handling was broken.
  • Loading branch information
avdv authored Jan 24, 2020
2 parents 6c51cd9 + fb39a9d commit 11107bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Metrics/BlockLength:
Exclude:
- 'spec/**/*'

Metrics/LineLength:
Layout/LineLength:
Max: 120

Metrics/ModuleLength:
Expand Down
10 changes: 6 additions & 4 deletions lib/colorls/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,14 @@ def git_dir_info(path)
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)
Expand Down
2 changes: 1 addition & 1 deletion lib/colorls/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def git_prefix(repo_path)
end

def git_subdir_status(repo_path)
IO.popen(['git', '-C', repo_path, 'status', '--porcelain', '-z', '-unormal', '--ignored', '.'])
yield IO.popen(['git', '-C', repo_path, 'status', '--porcelain', '-z', '-unormal', '--ignored', '.'])
end
end
end
Expand Down

0 comments on commit 11107bd

Please sign in to comment.