6 def check(args, input=None):
7 return subprocess.check_output(args, text=True, input=input).strip()
10 # config repo and branch
11 REPO = "/srv/git/git-hooks"
16 dirs = check(["git", "ls-tree", "--name-only", BRANCH]).splitlines()
19 files = check(["git", "ls-tree", "--name-only", f"{BRANCH}:{d}"]).splitlines()
22 file = check(["git", "--no-pager", "show", f"{BRANCH}:{d}/{f}"])
23 with open(f"/srv/git/{d}/hooks/{f}", "w") as fd: