Add a pre-commit hook
parent
b4ce7d7e1d
commit
052f3e9d9c
@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require_relative '../utils/copyrighted'
|
||||||
|
|
||||||
|
source_files_exts = ['.S', '.rs', '.rb']
|
||||||
|
|
||||||
|
staged_files = `git --no-pager diff --name-only --cached`.split(/\n/)
|
||||||
|
|
||||||
|
need_inspection = []
|
||||||
|
staged_files.each do |f|
|
||||||
|
need_inspection << f if
|
||||||
|
f == 'Makefile' || source_files_exts.include?(File.extname(f))
|
||||||
|
end
|
||||||
|
|
||||||
|
error = false
|
||||||
|
need_inspection.each do |f|
|
||||||
|
error = true unless copyrighted?(f, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
exit 1 if error
|
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
git config core.hooksPath .githooks
|
Loading…
Reference in New Issue