From: patrick-scho Date: Tue, 3 Jun 2025 12:48:23 +0000 (+0200) Subject: add comments to git-hooks/post-receive X-Git-Url: https://gitweb.ps.run/git-hooks/commitdiff_plain/b6f6ce350d6080e2b2b7a6420447307fc93f56c4?hp=1071cff3ca2626dca967eb0989c0874764c460e2 add comments to git-hooks/post-receive --- 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)