fix(hooks): skip post-checkout rebuild when HEAD doesn't move#2061
Open
vlecourt wants to merge 1 commit into
Open
fix(hooks): skip post-checkout rebuild when HEAD doesn't move#2061vlecourt wants to merge 1 commit into
vlecourt wants to merge 1 commit into
Conversation
git checkout -b <new-branch> off the current HEAD sets BRANCH_SWITCH=1 even though PREV_HEAD and NEW_HEAD are identical, so the post-checkout hook launched a full graph rebuild for a switch with no underlying code change. Since community detection isn't fully deterministic across runs, that produced pure reordering churn in graphify-out/graph.json, which teams ended up discarding via git stash. Fixes Graphify-Labs#2060 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
🎉 Awesome first PR! Really nice improvement. I have a feeling this is going to become part of our daily workflow. Thanks for contributing this—great job! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
git checkout -b <new-branch>off the current HEAD setsBRANCH_SWITCH=1even thoughPREV_HEAD/NEW_HEADare identical, so the post-checkout hook launched a full graph rebuild for a switch with no underlying code change.graphify-out/graph.json, which teams ended up discarding viagit stash.BRANCH_SWITCH != 1check: skip the rebuild whenPREV_HEADequalsNEW_HEAD.Fixes #2060
Test plan
uv run pytest tests/test_hooks.py -q— 61 passed (3 new tests covering the guard, static + end-to-end)uv run ruff check graphify/hooks.py tests/test_hooks.pyuv run python -m tools.skillgen --check