diff --git a/.mise/tasks/obfuscate b/.mise/tasks/obfuscate index 0684d3b..dea6810 100755 --- a/.mise/tasks/obfuscate +++ b/.mise/tasks/obfuscate @@ -117,7 +117,7 @@ while IFS=$'\t' read -r relpath id; do new_count=$((new_count + 1)) done < "$renamed" -git -C "$TARGET_DIR" add -- "${obfuscated_paths[@]}" +git -C "$TARGET_DIR" add --sparse -- "${obfuscated_paths[@]}" git -C "$TARGET_DIR" rm --cached --quiet --ignore-unmatch -- \ "${readable_paths[@]}" diff --git a/.mise/tasks/stage b/.mise/tasks/stage index a5178a7..0503c10 100755 --- a/.mise/tasks/stage +++ b/.mise/tasks/stage @@ -10,6 +10,7 @@ source "$MISE_CONFIG_ROOT/lib/common.sh" source "$MISE_CONFIG_ROOT/lib/obfuscate.sh" source "$MISE_CONFIG_ROOT/lib/suppress.sh" source "$MISE_CONFIG_ROOT/lib/changes.sh" +source "$MISE_CONFIG_ROOT/lib/hooks.sh" require_git notes_dir="${usage_dir:-notes}" @@ -215,6 +216,12 @@ if [ "${usage_dry_run:-}" = "true" ]; then exit 0 fi +if ! required_pre_commit_hooks_ready "$notes_dir"; then + echo "Error: required Notes pre-commit hooks are missing or stale; refusing to stage readable notes." >&2 + echo "Run 'notes install-hooks --yes', then retry." >&2 + exit 1 +fi + # Stage each file using git add -f to bypass .git/info/exclude staged=0 for relpath in ${to_stage[@]+"${to_stage[@]}"}; do diff --git a/.mise/tasks/unlock b/.mise/tasks/unlock index dbb3c1b..0dc3eec 100755 --- a/.mise/tasks/unlock +++ b/.mise/tasks/unlock @@ -5,6 +5,7 @@ set -euo pipefail source "$MISE_CONFIG_ROOT/lib/common.sh" +source "$MISE_CONFIG_ROOT/lib/hooks.sh" require_git require_initialized require_rudi @@ -35,3 +36,8 @@ if [ -f "$TARGET_DIR/notes/.manifest" ]; then cd "$MISE_CONFIG_ROOT" && NOTES_CALLER_PWD="$TARGET_DIR" mise run -q deobfuscate fi fi + +if ! required_pre_commit_hooks_ready notes; then + echo "Warning: required Notes pre-commit hooks are missing or stale." >&2 + echo "Run 'notes install-hooks --yes' before staging readable notes." >&2 +fi diff --git a/README.md b/README.md index 308a5e6..faca7b0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ **Collective memory, encrypted.** -[![tests: 450](https://img.shields.io/badge/tests-450-brightgreen?style=flat)](test/) +[![tests: 459](https://img.shields.io/badge/tests-459-brightgreen?style=flat)](test/) ![lints: 8](https://img.shields.io/badge/lints-8-blue?style=flat) [![license: MIT](https://img.shields.io/badge/license-MIT-blue?style=flat)](LICENSE) diff --git a/lib/hooks.sh b/lib/hooks.sh index 0094b77..e279175 100644 --- a/lib/hooks.sh +++ b/lib/hooks.sh @@ -10,13 +10,15 @@ _hook_template_value() { } _render_notes_hook_template() { - local template="${1:?usage: _render_notes_hook_template