Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 98239ee

Browse files
committedMar 7, 2025··
Improve the error message when an existing config is found
1 parent 06895a5 commit 98239ee

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed
 

‎modules/pre-commit.nix

+7-5
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,13 @@ in
431431
[ -L "''${GIT_WC}/${cfg.configPath}" ] && unlink "''${GIT_WC}/${cfg.configPath}"
432432
433433
if [ -e "''${GIT_WC}/${cfg.configPath}" ]; then
434-
echo 1>&2 "git-hooks.nix: WARNING: Refusing to install because of pre-existing ${cfg.configPath}"
435-
echo 1>&2 " 1. Translate ${cfg.configPath} contents to the new syntax in your Nix file"
436-
echo 1>&2 " see https://github.com/cachix/git-hooks.nix#getting-started"
437-
echo 1>&2 " 2. remove ${cfg.configPath}"
438-
echo 1>&2 " 3. add ${cfg.configPath} to .gitignore"
434+
echo 1>&2 "git-hooks.nix: WARNING: Refusing to install because of an existing config at ${cfg.configPath}"
435+
echo 1>&2 ""
436+
echo 1>&2 " To migrate the existing config to a Nix configuration:"
437+
echo 1>&2 " 1. Translate the contents of ${cfg.configPath} into a Nix configuration."
438+
echo 1>&2 " See https://github.com/cachix/git-hooks.nix#getting-started"
439+
echo 1>&2 " 2. Remove ${cfg.configPath}"
440+
echo 1>&2 " 3. Add ${cfg.configPath} to .gitignore"
439441
else
440442
if ${boolToString cfg.addGcRoot}; then
441443
nix-store --add-root "''${GIT_WC}/${cfg.configPath}" --indirect --realise ${cfg.configFile}

0 commit comments

Comments
 (0)
Please sign in to comment.