Sha256: f40c82873c3358e45dfe3879eb0385149efde3231e4592de5b70225bc930733e

Contents?: true

Size: 432 Bytes

Versions: 1

Compression:

Stored size: 432 Bytes

Contents

module PreCommit
  class WhiteSpaceCheck
    def self.call(_)
      errors = `git diff-index --check --cached HEAD -- 2>&1`
      return if $?.success?

      # Initial commit: diff against the empty tree object
      if errors =~ /fatal: bad revision 'HEAD'/
        errors = `git diff-index --check --cached 4b825dc642cb6eb9a060e54bf8d69288fbee4904 -- 2>&1`
        return if $?.success?
      end

      errors
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pre-commit-0.11.0 lib/pre-commit/checks/whitespace_check.rb