Only check for staged changes if writing output

This commit is contained in:
Sven Weidauer 2022-06-06 11:40:40 +02:00
parent 7da4a0e0f0
commit aad741f8cc

View file

@ -39,7 +39,7 @@ module FormatStaged
return false unless formatted.size == files.size
quiet = @verbose ? [] : ['--quiet']
return get_status('git', 'diff-index', '--cached', '--exit-code', *quiet, 'HEAD') != 0
return !write || get_status('git', 'diff-index', '--cached', '--exit-code', *quiet, 'HEAD') != 0
end
def repo_root