Skip to content

Fix commit hooks respecting core.hooksPath#2159

Open
Siesta0217 wants to merge 1 commit into
gitpython-developers:mainfrom
Siesta0217:fix-core-hooks-path-commit-hooks
Open

Fix commit hooks respecting core.hooksPath#2159
Siesta0217 wants to merge 1 commit into
gitpython-developers:mainfrom
Siesta0217:fix-core-hooks-path-commit-hooks

Conversation

@Siesta0217

Copy link
Copy Markdown

Summary

  • Resolve commit hook paths via git rev-parse --git-path hooks/<name> so GitPython follows Git's core.hooksPath configuration.
  • Keep the existing default .git/hooks behavior when core.hooksPath is not configured.
  • Add regression coverage for a pre-commit hook stored in a custom hooks path.

Fixes #2083

Test Plan

  • python -m pytest test/test_index.py::TestIndex::test_pre_commit_hook_respects_core_hooks_path test/test_index.py::TestIndex::test_pre_commit_hook_success -q -o 'addopts='
  • python -m pytest test/test_index.py::TestIndex::test_run_commit_hook test/test_index.py::TestIndex::test_pre_commit_hook_fail test/test_index.py::TestIndex::test_commit_msg_hook_success -q -o 'addopts='
  • ruff check git/index/fun.py test/test_index.py
Use git rev-parse --git-path when resolving commit hook paths so GitPython follows Git's core.hooksPath configuration.\n\nAdd regression coverage for a pre-commit hook stored in a custom hooks path.\n\nFixes gitpython-developers#2083
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants