Repository navigation
feat(installer): link the hook into repositories instead of copying it - #3
Merged
Merged
Conversation
On Linux and macOS, the hook now lives once in ~/git-commit-ai/prepare-commit-msg. The template directory has a link to it, which git init and git clone copy into new repositories, so that every update of the hook reaches them. A new step replaces copies of the hook from this installer with links, in the repository of the current directory and in the repositories below each directory of the new option --repos. The default answer is yes. Hooks from other sources, repositories without the hook and repositories with their own core.hooksPath stay as they are. On Windows, the step updates the copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Problem
git initcopies the hook from the template directory and never replaces a hook that a repository already has. After an update of the installer, every existing repository keeps its old copy of the hook.Change
~/git-commit-ai/prepare-commit-msg(written atomically). The template directory has a link to it.git initandgit clonecopy the link, so new repositories get every future update.--repos DIR(repeatable, up to 5 levels deep). The default answer is yes. Hooks from other sources, repositories without the hook and repositories with their owncore.hooksPathstay as they are. The step lists at most 10 repositories by name.Tests
bash tests/run.sh: 68 checks pass on Linux, including new checks for the links,--repos, hooks from other sources, repositories without the hook and repositories with their owncore.hooksPath. Also ran it for real with--repos ~/workspace: 371 repositories linked, a second run reports none left.🤖 Generated with Claude Code