Skip to content

Commit

Permalink
Add workaround for when core.hooksPath is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzime committed May 30, 2023
1 parent ca2fdbf commit ac27fe1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/pre-commit.nix
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ in
${
lib.concatStringsSep
"\n"
"\n"
(lib.mapAttrsToList
(hookName: hookConf:
''
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit ac27fe1

Please sign in to comment.