From 89129fd53aab08cc4a6258aa31985037bd88f3ce Mon Sep 17 00:00:00 2001 From: tkl Date: Tue, 26 Jul 2016 14:52:07 +0200 Subject: [PATCH] script to create git hook symlinks added --- config/git_hooks/post-commit | 5 +++++ config/git_hooks/post-merge | 5 +++++ source/scripts/symlink_hooks.py | 20 ++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100755 config/git_hooks/post-commit create mode 100755 config/git_hooks/post-merge create mode 100644 source/scripts/symlink_hooks.py diff --git a/config/git_hooks/post-commit b/config/git_hooks/post-commit new file mode 100755 index 0000000..aac7479 --- /dev/null +++ b/config/git_hooks/post-commit @@ -0,0 +1,5 @@ +#!/usr/bin/python2 +import os +os.system("source/scripts/get_history.py") + + diff --git a/config/git_hooks/post-merge b/config/git_hooks/post-merge new file mode 100755 index 0000000..aac7479 --- /dev/null +++ b/config/git_hooks/post-merge @@ -0,0 +1,5 @@ +#!/usr/bin/python2 +import os +os.system("source/scripts/get_history.py") + + diff --git a/source/scripts/symlink_hooks.py b/source/scripts/symlink_hooks.py new file mode 100644 index 0000000..fdca8ea --- /dev/null +++ b/source/scripts/symlink_hooks.py @@ -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:])