Git pre-push hook should be generated to location defined by `core.hooksPath`

Open
#2,853 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
java
Domain
build-system

Research direction

Start with the ./gradlew spotlessInstallGitPrePushHook entry point and trace where it chooses the hook destination. Check how the configured core.hooksPath and the default .git/hooks location are handled. Done means the generated pre-push hook is written to the configured path, while retaining the default behavior when no custom path is set.

Written by the indexing model from the issue text.

Description

In our project, we define all our git hooks at .githooks, so we can version control them and have them shared amongst our team. We recommend that those in our project set up the git hooks by running git config --local unset core.hooksPath.

The git pre-push hook generated by ./gradlew spotlessInstallGitPrePushHook writes the hook to .git/hooks, instead of wherever git config core.hooksPath is pointing to. By default, git config core.hooksPath is equivalent to .git/hooks, but it can be customised to something else, like in our case.

Dominant language
Java
Stars
5.7k
Forks
560
Avg merge
1d 13h
Merged PRs (30d)
43

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diffplug/spotless

All issues in diffplug/spotless

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.