fangorn/ex_git_objectstore
public
ref:43d82342c06f1a94508033823483ae8caaccfb90
Add update and post-receive hook support (#5)
## Summary
- Add `update_hook` (per-ref, can reject individual refs) and `post_receive_hook` (after all updates, for notifications/CI triggers) to receive-pack
- Follows the same pluggable function pattern as the existing `pre_receive_hook`
Closes #9
## Hook execution order
1. `pre_receive_hook(commands)` — all-or-nothing, rejects entire push
2. `update_hook(ref, old_sha, new_sha)` — per-ref, rejection blocks only that ref
3. Ref updates applied
4. `post_receive_hook(changes)` — receives full change list with statuses, failures logged but don't affect result
## Test plan
- [x] update_hook called per-ref with correct arguments
- [x] update_hook rejection blocks only the affected ref, others succeed
- [x] post_receive_hook called with full change list including statuses
- [x] post_receive_hook includes rejected refs in changes
- [x] post_receive_hook failure doesn't affect push result
- [x] post_receive_hook not called when pre_receive_hook rejects
- [x] No hooks configured works as before
- [x] 556 tests pass, dialyzer clean
SHA:
43d82342c06f1a94508033823483ae8caaccfb90
Author:
Anvil <noreply@anvil.fangorn.io>
Date:
2026-04-09 20:13
Parents:
a3f0318
2 files changed
+330
-4
| Type | ||
|---|---|---|
|
|
lib/ex_git_objectstore/protocol/receive_pack.ex | +62 −4 |
|
||