One line of bash for every repository
We keep one plain text file that lists every repository we gate, one path per line. Then we needed a new hook in all of them. You don’t need a full programming language, or to do it by hand. Plain ol’ bash does it in one line: while read -r r; do install-hooks "$r"; done < <(grep -vE '^[[:space:]]*(#|$)' repos.txt | sed "s|\$HOME|$HOME|; s|^~|$HOME|") install-hooks stands in for whatever installs your hook. Ours is our commit gate’s own install command. ...