From b6f6ce350d6080e2b2b7a6420447307fc93f56c4 Mon Sep 17 00:00:00 2001 From: patrick-scho Date: Tue, 3 Jun 2025 14:48:23 +0200 Subject: [PATCH 1/1] add comments to git-hooks/post-receive --- git-hooks/post-receive | 4 ++++ 1 file changed, 4 insertions(+) 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) -- 2.50.1