diff options
| author | Paul Buetow <paul@buetow.org> | 2026-06-17 21:45:40 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-06-17 21:45:40 +0300 |
| commit | eb8cbbbcb9a613757ac4440246c43ebba6758afe (patch) | |
| tree | 08ecc67cbc3d265d1e0379ba965017c06ca3a790 /tests | |
| parent | 25aff490d739290602b28bdc53936dd3ea6ed939 (diff) | |
ln0 make --clean remove leftover staging directories
The --clean action deleted DIST_DIR but left behind the staging/backup
directories the generation pipeline creates as siblings of DIST_DIR
(.shuriken.<basename>.staging.* / .backup.*). Users expect --clean to
remove all generation output, so extend it to also delete those.
Cleanup runs after the validate_clean_dist_dir safety guard (8n0), so a
dangerous DIST_DIR still aborts before any deletion. It only matches
shuriken's own basename-specific staging/backup prefixes (the exact
mktemp templates from config.staging.source.sh), uses nullglob so a
missing match never expands to a literal pattern, and only removes
directories. Unrelated dotfiles in the parent are never touched.
Update test_clean to assert the staging/backup dirs are removed while
unrelated entries survive, and document the behavior in the CLI usage
text and README.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/cli.sh | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/cli.sh b/tests/cli.sh index 5a58384..ad2a1d7 100755 --- a/tests/cli.sh +++ b/tests/cli.sh @@ -253,21 +253,36 @@ test_just_install_and_deinstall_with_destdir() { test::teardown } +# --clean removes DIST_DIR and any leftover staging/backup directories that the +# generation pipeline created as siblings of DIST_DIR (ln0). Unrelated dotfiles +# and other entries in the parent must survive: we only target shuriken's own +# basename-specific ".shuriken.<basename>.staging.*"/".backup.*" prefixes. test_clean() { local staging_dir + local backup_dir + local unrelated_dir + local unrelated_file test::setup printf 'DIST_DIR=%q/dist\n' "$TEST_TMPDIR" \ > "$TEST_TMPDIR/shuriken.conf" mkdir -p "$TEST_TMPDIR/dist" staging_dir="$TEST_TMPDIR/.shuriken.dist.staging.manual" - mkdir -p "$staging_dir" + backup_dir="$TEST_TMPDIR/.shuriken.dist.backup.manual" + unrelated_dir="$TEST_TMPDIR/.shuriken.other.staging.keep" + unrelated_file="$TEST_TMPDIR/.keep-me" + mkdir -p "$staging_dir" "$backup_dir" "$unrelated_dir" + touch "$unrelated_file" ( cd "$TEST_TMPDIR" "$TEST_SHURIKEN" --clean test::assert_path_absent "$TEST_TMPDIR/dist" - test::assert_dir_exists "$staging_dir" + test::assert_path_absent "$staging_dir" + test::assert_path_absent "$backup_dir" + # Unrelated entries (different basename / non-shuriken) must survive. + test::assert_dir_exists "$unrelated_dir" + test::assert_file_exists "$unrelated_file" ) test::teardown } |
