script to create git hook symlinks added
This commit is contained in:
parent
a735b159cb
commit
89129fd53a
5
config/git_hooks/post-commit
Executable file
5
config/git_hooks/post-commit
Executable 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
5
config/git_hooks/post-merge
Executable file
@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/python2
|
||||||
|
import os
|
||||||
|
os.system("source/scripts/get_history.py")
|
||||||
|
|
||||||
|
|
20
source/scripts/symlink_hooks.py
Normal file
20
source/scripts/symlink_hooks.py
Normal 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:])
|
Loading…
Reference in New Issue
Block a user