Sha256: fbc790ea6f51709b4dd4692be3b600dd42da5d7d4a312695de87b6d51fb4bf93
Contents?: true
Size: 664 Bytes
Versions: 3
Compression:
Stored size: 664 Bytes
Contents
module PreCommit class MergeConflict attr_accessor :staged_files def self.call check = new check.staged_files = Utils.staged_files('.') check.run end def run if detected_bad_code? $stderr.puts 'pre-commit: detected a merge conflict' $stderr.puts errors $stderr.puts $stderr.puts 'pre-commit: You can bypass this check using `git commit -n`' $stderr.puts false else true end end def detected_bad_code? system("grep '<<<<<<<' #{staged_files} --quiet") end def errors `grep -nH '<<<<<<<' #{staged_files}` end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pre-commit-0.8.1 | lib/pre-commit/checks/merge_conflict.rb |
pre-commit-0.8.0 | lib/pre-commit/checks/merge_conflict.rb |
pre-commit-0.7.0 | lib/pre-commit/checks/merge_conflict.rb |