]> gitweb.ps.run Git - git-hooks/commitdiff
add comments to git-hooks/post-receive
authorpatrick-scho <patrick.schoenberger@posteo.de>
Tue, 3 Jun 2025 12:48:23 +0000 (14:48 +0200)
committerpatrick-scho <patrick.schoenberger@posteo.de>
Tue, 3 Jun 2025 12:48:23 +0000 (14:48 +0200)
git-hooks/post-receive

index 8e4c8372f6c39074cc17d8bfb110bf9d03edaf05..2af01a856829dce758fa3b6639d0fed60f0954a1 100755 (executable)
@@ -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)