Created
August 9, 2013 22:04
-
-
Save trshafer/6197684 to your computer and use it in GitHub Desktop.
pre-commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# do not check in code with <<<<< nor debugger | |
diff_contents = `git diff --cached --unified=0 --diff-filter=AM -z HEAD` | |
bad_commit_text = diff_contents =~ /^\+(<{3,}|(\s*|.*;\s*)debugger)/ | |
abort "Aborting: Found debugger or <<< in commit diff." if bad_commit_text | |
# looks for text in reminders.txt | |
reminder_location = 'ignored/reminders.txt' | |
file_location = File.join( File.dirname(__FILE__), '..', '..', reminder_location) | |
if File.exists?(file_location) && IO.readlines(file_location).join('').strip != '' | |
abort "Aborting: reminders.txt not satisfied." | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment