feat(snix/shell.nix): automatically set up the commit-msg hook

Lix does this and it has eliminated anyone ever having to think about
it; it just works.

Change-Id: I24a35d2d0b31f1245172d332bac40fe0b39dc2b9
Reviewed-on: https://cl.snix.dev/c/snix/+/30604
Tested-by: besadii
Reviewed-by: Florian Klink <flokli@flokli.de>
This commit is contained in:
Jade Lovelace 2025-07-14 19:40:14 -07:00
parent be68d89901
commit 7bc461b162
2 changed files with 29 additions and 0 deletions

View file

@ -56,10 +56,18 @@ git remote set-url origin "https://$USER@cl.snix.dev/a/snix"
replicates fast enough, then update to --push only -->
### Install the commit-msg hook
Setting up the `commit-msg` Git hook is done for you automagically the first time you enter the shell.
If it didn't work for you for some reason, see the manual steps below.
Gerrit uses a `commit-msg` hook to add a `Change-Id: …` field to each commit
message if not present already. This allows Gerrit to identify new revisions /
updates of old commits, and track them as new revisions of the same "CL" [^2].
<details>
<summary>Manually installing the hook</summary>
To install the commit-msg hook, run the following from the repo root:
```bash
@ -68,6 +76,8 @@ curl -Lo .git/hooks/commit-msg https://cl.snix.dev/tools/hooks/commit-msg
chmod +x .git/hooks/commit-msg
```
</details>
{{< callout context="tip" title="Did you know?" icon="outline/rocket" >}}
Gerrit refuses receiving commits without these `Change-Id: …` fields.