From ac27fe1daa19db5b78fda1d947de0b6859f21ddd Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Mon, 29 May 2023 15:26:19 +1000 Subject: [PATCH] Add workaround for when `core.hooksPath` is set --- modules/pre-commit.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/pre-commit.nix b/modules/pre-commit.nix index c9cabc8f..964d6590 100644 --- a/modules/pre-commit.nix +++ b/modules/pre-commit.nix @@ -274,7 +274,7 @@ in ${ lib.concatStringsSep - "\n" + "\n" (lib.mapAttrsToList (hookName: hookConf: '' @@ -429,6 +429,7 @@ in for hook in $hooks; do pre-commit uninstall -t $hook done + ${git}/bin/git config --local core.hooksPath "" # Add hooks for configured stages (only) ... if [ ! -z "${concatStringsSep " " install_stages}" ]; then for stage in ${concatStringsSep " " install_stages}; do @@ -454,6 +455,7 @@ in else pre-commit install fi + ${git}/bin/git config --local core.hooksPath "$(${git}/bin/git rev-parse --git-common-dir)/hooks" fi fi fi