Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .mise/tasks/stage
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,11 @@ if [ -n "$conflicting_notes" ]; then
fi

double_tracked=""
if ! double_tracked=$(detect_double_tracked_notes "$TARGET_DIR" "$notes_dir" 2>/dev/null); then
double_tracked=""
double_tracked_status=0
double_tracked=$(detect_double_tracked_notes "$TARGET_DIR" "$notes_dir") || double_tracked_status=$?
if [ "$double_tracked_status" -ne 0 ]; then
echo "Error: failed to inspect double-tracked note paths." >&2
exit "$double_tracked_status"
fi
if [ -n "$double_tracked" ]; then
blocked_tracked=()
Expand Down
7 changes: 5 additions & 2 deletions .mise/tasks/status
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ fi
# --- Double-tracked notes (readable + obfuscated both tracked) ---

double_tracked=""
if ! double_tracked=$(detect_double_tracked_notes "$TARGET_DIR" "$NOTES_DIR" 2>/dev/null); then
double_tracked=""
double_tracked_status=0
double_tracked=$(detect_double_tracked_notes "$TARGET_DIR" "$NOTES_DIR") || double_tracked_status=$?
if [ "$double_tracked_status" -ne 0 ]; then
echo "Error: failed to inspect double-tracked note paths." >&2
exit "$double_tracked_status"
fi
double_tracked_count=0
if [ -n "$double_tracked" ]; then
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

**Collective memory, encrypted.**

[![tests: 445](https://img.shields.io/badge/tests-445-brightgreen?style=flat)](test/)
[![tests: 446](https://img.shields.io/badge/tests-446-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)

Expand Down
31 changes: 31 additions & 0 deletions test/changes.bats
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ SH
chmod +x "$FAILING_FIND_BIN/find"
}

setup_failing_tracked_path_inspection_overlay() {
FAILING_GIT_BIN="$BATS_TEST_TMPDIR/failing-git-bin"
local real_git
real_git=$(command -v git)
mkdir -p "$FAILING_GIT_BIN"
cat > "$FAILING_GIT_BIN/git" <<'SH'
#!/usr/bin/env bash
case " $* " in
*" ls-files -z -- notes ") exit 73 ;;
esac
exec "$REAL_GIT" "$@"
SH
chmod +x "$FAILING_GIT_BIN/git"
export REAL_GIT="$real_git"
}

# ── detect_changes ────────────────────────────────────────────

@test "detect_changes: no changes when files match HEAD" {
Expand Down Expand Up @@ -281,6 +297,21 @@ SH
[[ "$output" == *"failed to inspect note changes"* ]]
}

@test "safety consumers propagate double-tracked path inspection failure" {
setup_failing_tracked_path_inspection_overlay
printf '# Alpha modified\n' > "$NOTES_CALLER_PWD/notes/alpha.md"

PATH="$FAILING_GIT_BIN:$PATH" run notes stage alpha.md
[ "$status" -ne 0 ]
[[ "$output" == *"failed to inspect double-tracked note paths"* ]]
run git -C "$NOTES_CALLER_PWD" diff --cached --name-only
[ -z "$output" ]

PATH="$FAILING_GIT_BIN:$PATH" run notes status --json
[ "$status" -ne 0 ]
[[ "$output" == *"failed to inspect double-tracked note paths"* ]]
}

@test "notes changes fails instead of widening an unparsed file scope" {
local mock_bin="$BATS_TEST_TMPDIR/failing-xargs-bin"
make_failing_xargs_overlay "$mock_bin"
Expand Down
Loading