Last active
August 29, 2015 14:13
-
-
Save celeen/90992a635f42eb87534a to your computer and use it in GitHub Desktop.
commit-hook for finding text
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 python | |
import sys, os, re | |
import subprocess | |
diff = subprocess.check_output(['git', 'diff', 'HEAD']) | |
def check_for_text(text, diff): | |
exp = re.compile(text) | |
match = exp.search(diff) | |
if match: | |
print "Please remove the '@sandbox' tag" | |
sys.exit(1) | |
else: | |
sys.exit(0) | |
check_for_text('\+.*(?P<sandbox>(?<!")@sandbox)', diff) |
updated the pre-commit so that it ignores any @sandbox tags that are immediately preceded by a "
presumably, these are in runner files, and haven't been left in the repo by accident
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe not the most effective, but I wanted to practice/keep learning python.