diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-05 15:07:03 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-05 15:07:03 +0800 |
commit | 6a78d0ab5324bf1caf7d7f2b79a8eb2b62921933 (patch) | |
tree | 74a801afd4e0d58757351f119b11351e8ab0105a /content/forge/internals/hookc.md | |
parent | Update forge docs (diff) | |
download | website-6a78d0ab5324bf1caf7d7f2b79a8eb2b62921933.tar.gz website-6a78d0ab5324bf1caf7d7f2b79a8eb2b62921933.tar.zst website-6a78d0ab5324bf1caf7d7f2b79a8eb2b62921933.zip |
Diffstat (limited to 'content/forge/internals/hookc.md')
-rw-r--r-- | content/forge/internals/hookc.md | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/content/forge/internals/hookc.md b/content/forge/internals/hookc.md new file mode 100644 index 0000000..3c270fc --- /dev/null +++ b/content/forge/internals/hookc.md @@ -0,0 +1,40 @@ +--- +title: hookc +--- + +`hookc` is a helper binary for Git server-side hooks that relays the hook's +context to a persistent daemon via a UNIX domain socket and communicates back +any relevant responses. + +It is intended to be invoked by `git-receive-pack` for hooks such as +`pre-receive`, `update`, and `post-receive`. + +## Environment variables + +- `LINDENII_FORGE_HOOKS_SOCKET_PATH`: + Absolute path to the UNIX domain socket on which the daemon is listening. +- `LINDENII_FORGE_HOOKS_COOKIE`: + 64-character authentication cookie used to validate the hook client to the + daemon. + +## Operation + +lindenii-forge-hookc collects the following information and sends it to +the daemon: + +- All command-line arguments +- All `GIT_*` environment variables +- The raw hook stdin (e.g., old/new ref triplets for pre-receive) + +After sending this data, it waits for a one-byte status code from the daemon, +which becomes `hookc`'s own exit status. + +If the daemon sends any output afterward, it is forwarded to standard error and +will appear as `remote:` output to the user. + +## Known issues + +- The status byte from the daemon currently must be sent before any + stderr output. +- Currently assumes stdin and stderr are pipes, which is not guaranteed + in future versions of Git. |