You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
post-commit hook: every exit 0 in the generated block terminates the whole hook — silently kills anything appended after it (incl. repo-local hook chaining) on root commits, rebases and worktrees #2986
The generated post-commit hook is a flat sh script whose skip conditions use bare exit 0. In a flat script that terminates the entire hook process, not just graphify's section. Any block appended after graphify's markers — including hook-chaining logic that other tools install — is silently skipped whenever graphify decides to skip itself.
This is not an edge case: one of those exits fires on every root commit of every repository.
Affected
Confirmed by reading graphify/hooks.py in the published wheels for 0.9.45 (16 exit 0) and 0.9.48 (17). Installed and observed with 0.9.39 and 0.9.45. The count went up rather than down between those releases, so this looks unnoticed rather than known.
Each is correct as an intent ("graphify should not run here") but wrong as a mechanism in a shared hook file, because it ends the process.
The root-commit case is the most surprising one. On a repository's first commit HEAD~1 does not resolve, so the fallback git diff --name-only HEAD compares the working tree against HEAD — clean immediately after a commit — yielding an empty CHANGED and an exit 0.
Reproduction
# global hook: graphify's block, followed by anything elseprintf'#!/bin/sh\n'>~/.config/git/hooks/post-commit
graphify hook install # appends the graphify blockprintf'printf "[after-graphify RAN]\\n"\n'>>~/.config/git/hooks/post-commit
mkdir repro &&cd repro && git init -q
printf'x\n'> f.txt && git add -A
git commit -m "root"# -> "[after-graphify RAN]" does NOT printprintf'y\n'>> f.txt && git add -A
git commit -m "second"# -> it prints
The same asymmetry appears during rebase, cherry-pick, in linked worktrees, with GRAPHIFY_SKIP_HOOK=1, and on commits touching only graphify-out/.
Impact
hooks.py contains no chaining logic of its own, so it implicitly assumes it owns the hook file or runs last. In practice it is commonly appended alongside other tools' blocks. Where another tool's block chains to repository-local hooks, those repo-local post-commit hooks silently stop running in all the situations above — no error, no output, just nothing.
Suggested fix
Wrap the emitted block in a subshell so the skip conditions become local:
(
... existing generated block ...
) ||true
exit 0 then leaves the subshell, graphify skips itself exactly as intended, and the hook continues. Verified locally against 0.9.45: root commits, graphify-out/-only commits, and normal code commits all now continue past the block, while graphify's own rebuild behaviour is unchanged (GRAPH_REPORT.md still produced on code commits).
An alternative that avoids the subshell is replacing each exit 0 with a guard variable checked before the rebuild step, but the subshell wrap is a one-line change and cannot miss an exit path.
Happy to open a PR if the subshell approach looks right.
Activity
fix(hooks): a graphify skip must not terminate the whole git hook (#2986
safishamsi commentedon Sep 7, 2026
Fixed in v0.9.56 by #3108 (thanks @abhay-codes07) — a git-hook skip no longer terminates the whole hook. Release: https://github.com/Graphify-Labs/graphify/releases/tag/v0.9.56