diff options
| -rwxr-xr-x | git-hooks/post-receive | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/git-hooks/post-receive b/git-hooks/post-receive index 8e4c837..2af01a8 100755 --- a/git-hooks/post-receive +++ b/git-hooks/post-receive @@ -11,14 +11,18 @@ def check(args, input=None): REPO = "/srv/git/git-hooks" BRANCH = "main" +# cd into repo os.chdir(REPO) +# list all directories dirs = check(["git", "ls-tree", "--name-only", BRANCH]).splitlines() for d in dirs: + # list all files files = check(["git", "ls-tree", "--name-only", f"{BRANCH}:{d}"]).splitlines() for f in files: + # print the hook and write it to the git repo file = check(["git", "--no-pager", "show", f"{BRANCH}:{d}/{f}"]) with open(f"/srv/git/{d}/hooks/{f}", "w") as fd: fd.write(file) |
