|

fix: guard hook against relative cwd to prevent infinite walk

Author: Chris Tusa <chris.tusa@leafscale.com>
Date: May 03, 2026 15:21
Changeset: 70f96db78e628e629a9e78819a98c860776dce1d
Branch: default

Changed files:

Diff

diff -r 2449115e2d9b -r 70f96db78e62 hooks/block-git-in-hg.sh
--- a/hooks/block-git-in-hg.sh	Sun May 03 13:13:22 2026 -0500
+++ b/hooks/block-git-in-hg.sh	Sun May 03 15:21:02 2026 -0500
@@ -37,7 +37,7 @@
 
 # Find VCS context for cwd: the closest .hg or .git ancestor.
 # If there's no usable cwd, allow.
-if [[ -z "$cwd" || ! -d "$cwd" ]]; then
+if [[ -z "$cwd" || ! -d "$cwd" || "$cwd" != /* ]]; then
     exit 0
 fi