Skip to content

Support Git pre-push hook generation to location defined by core.hooksPath - #3115

Merged
nedtwigg merged 5 commits into
diffplug:mainfrom
bgorkowy:add-support-for-config-defined-hooksPath
Oct 8, 2026
Merged

nedtwigg merged 5 commits into
diffplug:mainfrom
bgorkowy:add-support-for-config-defined-hooksPath

Conversation

@bgorkowy

Copy link
Copy Markdown
Contributor

Instead of spotlessInstallGitPrePushHook always writing to .git/hooks/pre-push, the task asks Git to resolve hooks/pre-push, so it respects core.hooksPath when configured, as requested in #2853 .
This uses ExecOperations to call git directly for the config, you have to decide if it is ok in this action - previous implementation operates only on the file api.

Changes

  • Resolve the effective hook path during task execution using Git.
  • Validate the destination before installation. The task skips unsupported repositories, hook directories outside the project, and destinations where pre-push is a directory or symbolic link.
  • Preserve the existing behavior for repositories using the default .git/hooks directory.
  • Add integration tests for the default location, a custom core.hooksPath, existing hooks, and unsupported destinations.

@nedtwigg
nedtwigg merged commit d76962f into diffplug:main Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants