sbt-git-hooks icon indicating copy to clipboard operation
sbt-git-hooks copied to clipboard

allow to rename hook dir name

Open shivamka1 opened this issue 4 years ago • 2 comments

Allow to rename the default hook directory name from git-hooks to .githooks or make .githooks as default for the sake for convention.

shivamka1 avatar Nov 26 '21 16:11 shivamka1

In theory it should be possible by overriding the hooksSourceDir setting key, but I am afraid it doesn't have any effect. I tried myself overriding the gitHooksDir setting key in order to adopt the plugin to git with sub-modules, but sbt warns me that this key is not used. Very strange.

Eli-Golin avatar Dec 21 '21 17:12 Eli-Golin

You can override default plugin settings in build.sbt file with i.e.:

Seq(GitHooks.globalSettings *)
gitHooksDir := Some(file("../.git/hooks"))

If you want to write hooks on each compile use:

(Compile / compile) := ((Compile / compile) dependsOn writeHooks).value

aartajew avatar Jun 14 '23 20:06 aartajew