@miller-tech/uap 1.26.0 → 1.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -32,10 +32,17 @@ fi
|
|
|
32
32
|
# (common for Write to a new file).
|
|
33
33
|
ABS_PATH="$(realpath -m "$FILE_PATH" 2>/dev/null || printf '%s' "$FILE_PATH")"
|
|
34
34
|
|
|
35
|
-
# Resolve repo root from current working directory.
|
|
36
|
-
#
|
|
35
|
+
# Resolve repo root from current working directory. In a BARE repo (this
|
|
36
|
+
# project's layout) `git rev-parse --show-toplevel` returns empty even from the
|
|
37
|
+
# project root — so fall back to the root derived from the hook's own location
|
|
38
|
+
# (<root>/.factory/hooks/) and FAIL CLOSED. A missing repo root must not silently
|
|
39
|
+
# disable the worktree guard, which previously let root-dir edits through.
|
|
37
40
|
REPO_ROOT="$(git rev-parse --show-toplevel 2>/dev/null || true)"
|
|
38
41
|
if [ -z "$REPO_ROOT" ]; then
|
|
42
|
+
REPO_ROOT="$(cd "$HOOK_DIR/../.." 2>/dev/null && pwd || true)"
|
|
43
|
+
fi
|
|
44
|
+
if [ -z "$REPO_ROOT" ]; then
|
|
45
|
+
# Genuinely cannot locate a project root — nothing to enforce against.
|
|
39
46
|
exit 0
|
|
40
47
|
fi
|
|
41
48
|
|