We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cec4833 commit 2ebdf36Copy full SHA for 2ebdf36
1 file changed
shell.nix
@@ -9,7 +9,13 @@ pkgs.mkShell {
9
];
10
11
shellHook = ''
12
- # Symlink the pre-commit hook into the .git/hooks directory
13
- ln -sf ../../scripts/pre-commit.sh .git/hooks/pre-commit
+ # Determine the repository root
+ REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
14
+
15
+ # Check if we are in the repository root
16
+ if [ "$REPO_ROOT" = "$(pwd)" ]; then
17
+ # Symlink the pre-commit hook into the .git/hooks directory
18
+ ln -sf ../../scripts/pre-commit.sh .git/hooks/pre-commit
19
+ fi
20
'';
21
}
0 commit comments