script to create git hook symlinks added

This commit is contained in:
tkl 2016-07-26 14:52:07 +02:00
parent a735b159cb
commit 89129fd53a
3 changed files with 30 additions and 0 deletions

5
config/git_hooks/post-commit Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/python2
import os
os.system("source/scripts/get_history.py")

5
config/git_hooks/post-merge Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/python2
import os
os.system("source/scripts/get_history.py")

View File

@ -0,0 +1,20 @@
#!/usr/bin/python2
# Used to create symlink for git hooks
from sys import argv
import os
def main(argv):
pwd = os.getcwd()
base_dir = pwd.replace("source/scripts", "")
target_dir = base_dir + "config/git_hooks/"
link_dir = base_dir + ".git/hooks/"
hooks = ["post-commit", "post-merge"]
for hook in hooks:
target = target_dir + hook
link = link_dir + hook
if (os.path.islink(link)) or (os.path.isfile(link)):
os.remove(link)
os.symlink(target, link)
if __name__ == "__main__":
main(argv[1:])