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
git hooks: post-checkout ignores GRAPHIFY_SKIP_HOOK; post-commit builds a rogue graph in worktrees #1809
Two small gaps in the generated post-commit / post-checkout git hooks (from graphify hook install):
(a) post-checkout ignores GRAPHIFY_SKIP_HOOK.post-commit early-exits on GRAPHIFY_SKIP_HOOK=1 (hooks.py:269), but the post-checkout template has no such check. So GRAPHIFY_SKIP_HOOK=1 suppresses commit-triggered rebuilds but not branch-switch rebuilds — surprising when scripting around the hooks (e.g. batch branch switches, or tooling that sets the var).
(b) post-commit builds a rogue graph inside worktrees. With core.hooksPath shared across git worktrees, a commit in any worktree fires these hooks. post-checkout guards on [ -d graphify-out ] and exits when it's absent, but post-commit has no such guard — so in a worktree with no local graphify-out/, it runs graphify update with cwd=worktree and writes a fresh delta-only graph.json into that worktree, which the user never asked for.
Version
graphifyy 0.9.12
Suggested fix
In the hook templates (hooks.py):
Add to the post-checkout template: [ "${GRAPHIFY_SKIP_HOOK:-0}" = "1" ] && exit 0
Add to the post-commit template: [ -d "graphify-out" ] || exit 0 (matching post-checkout)
Editing the generated .git/hooks/* directly works, but is regenerated on reinstall/upgrade, so the fix belongs in the templates.
Fixed in 5f57c46 (ships in 0.9.14). Both gaps addressed in the hook templates: (a) post-checkout now honors GRAPHIFY_SKIP_HOOK like post-commit; (b) both hooks short-circuit inside a linked worktree. For (b) I went with a worktree check (git-dir != git-common-dir) rather than the [ -d graphify-out ] guard you suggested — it targets the actual condition (a linked worktree) instead of the proxy (missing output dir), so it also skips the wasteful rebuild in a worktree that happens to have its own graphify-out/. The compare resolves both paths to absolute so the primary checkout isn't false-positived. Verified end-to-end against a real git worktree. Thanks @cdahl86-cyber.
Activity
safishamsi commentedon Jul 12, 2026
Fixed in
5f57c46(ships in 0.9.14). Both gaps addressed in the hook templates: (a)post-checkoutnow honorsGRAPHIFY_SKIP_HOOKlikepost-commit; (b) both hooks short-circuit inside a linked worktree. For (b) I went with a worktree check (git-dir != git-common-dir) rather than the[ -d graphify-out ]guard you suggested — it targets the actual condition (a linked worktree) instead of the proxy (missing output dir), so it also skips the wasteful rebuild in a worktree that happens to have its owngraphify-out/. The compare resolves both paths to absolute so the primary checkout isn't false-positived. Verified end-to-end against a realgit worktree. Thanks @cdahl86-cyber.fix(detect,hooks): honor .git/info/exclude; guard worktrees (#1810, #…
fix(detect,hooks): honor .git/info/exclude; guard worktrees (Graphify…
test: run hook probes only where sh exists; pin POSIX source-key expe…