From 312ddd4936f09ae27a180ca495cacf2c06faf33e Mon Sep 17 00:00:00 2001 From: dev Date: Sat, 14 Nov 2026 01:05:08 +0000 Subject: Comments: cut to what the code cannot say The comments had grown into essays. A file header explaining why the file exists, then a paragraph above each function restating what the next eight lines do, then a paragraph above that one explaining why that matters. The reader gets no further than the first paragraph, and the second is the one that goes stale: it describes code that has since changed, and nothing fails when it does. Cut by about half. What is left is the three things a comment can do that code cannot: say why the constraint exists (no regex because a hook must not depend on what might be missing at 3am), say what is not obvious from the shape (a bare ref name is a branch, never a tag; the seventh field of /etc/passwd is the shell), and say where it hurts (the NULL in an execvp array, the mode and owner that have to survive an atomic rewrite, the child that must not keep the hook's stdin). Block comments became // lines, which is also what the other C trees here use, and the file headers went to two or three lines. Section banners stayed: they are navigation, not prose. Behaviour is unchanged and the suites prove it: 171 direct checks, 162 behavioural, clean under -Werror and under ASan/UBSan. --- container/create-repo | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'container/create-repo') diff --git a/container/create-repo b/container/create-repo index 3accca8..5f80c92 100755 --- a/container/create-repo +++ b/container/create-repo @@ -1,14 +1,9 @@ #!/bin/sh -# create-repo - create a bare repository the policy can talk about. +# Create a bare repository. Nothing is installed in it: every repository reaches +# the shared hook through core.hooksPath, so one made by hand is enforced the same. # -# Nothing is installed here, which is the point: every repository reaches the -# shared hook through the global core.hooksPath in /etc/gitconfig, so a bare -# repository you make by hand is enforced exactly like one made here. -# -# The policy is a read-only mount in a deployment, so this cannot grant -# anything. It prints the line to add to your policy source; until a rule -# reaches the new repository, 'git-authz validate' says so and every push to it -# is refused. +# The policy is a read-only mount, so this only prints the line to add. + set -eu GIT_REPO_ROOT="${GIT_REPO_ROOT:-/var/lib/git}" -- cgit v1.2.3