diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-08 11:51:26 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-08 11:51:26 +0200 |
| commit | 9b57db37b6dca87247e30b1e5e2259094c7157b5 (patch) | |
| tree | 59f6302d0c870b7547a7565f0cdc95f46e94111b | |
| parent | 67d4196bb3c98b0f6c00e8e514d9060b1cf7be2f (diff) | |
| download | mkhintfile-9b57db37b6dca87247e30b1e5e2259094c7157b5.tar.gz mkhintfile-9b57db37b6dca87247e30b1e5e2259094c7157b5.zip | |
fix: skip bundled-dep apply prompt when nothing changed; release v1.2.3v1.2.3
After the version-aware reconcile, a --force run on an up-to-date bundle
package still asked "Apply bundled-dep updates?" with nothing to apply.
reconcile_bundle_deps report mode now signals whether there is anything
to apply via its exit code: 2 = changes present, 0 = all current / no
deps / fetch fail. The --check and --hintfile -V callers prompt only on
exit 2. apply mode still returns 0. Adds T-BM24 (all-current → no
prompt); 183 passed.
Bump MKHINT_VERSION and man title to 1.2.3, rebuild mkhint.1.gz.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rw-r--r-- | CHANGELOG.md | 10 | ||||
| -rwxr-xr-x | mkhint | 42 | ||||
| -rw-r--r-- | mkhint.1.gz | bin | 3486 -> 3485 bytes | |||
| -rw-r--r-- | mkhint.1.md | 2 | ||||
| -rwxr-xr-x | tests/mkhint_test.sh | 21 |
5 files changed, 60 insertions, 15 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a501e8..8bad93d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/). +## [1.2.3] - 2026-07-08 + +### Fixed +- The bundled-dep reconcile no longer prompts `Apply bundled-dep updates?` + when nothing changed. Report mode now signals whether there is anything to + apply (exit 2 = changes, 0 = all current / no deps / fetch fail), and the + `--check` and `--hintfile -V` callers only prompt when there is. Previously a + `--force` run on an up-to-date bundle package always asked, with nothing to + do. + ## [1.2.2] - 2026-07-08 ### Fixed @@ -45,7 +45,7 @@ if [[ ! -d $TMP_DIR ]]; then mkdir $TMP_DIR fi -readonly MKHINT_VERSION="1.2.2" +readonly MKHINT_VERSION="1.2.3" # Variables VERSION="" @@ -578,6 +578,9 @@ fetch_manifest() { # mode = report (print only) | apply (rewrite matched changed lines + md5). # Reconciles the DOWNLOAD line's extra URLs (index >= 1) against the manifest. # The primary URL (index 0) is never touched here. Guarded for set -e. +# In report mode: returns 2 when there are changes to apply, 0 otherwise (all +# current, no deps, fetch/parse fail) so a caller can skip the apply prompt. +# apply mode always returns 0. reconcile_bundle_deps() { local pkg="$1" hint="$2" murl="$3" mode="$4" @@ -667,7 +670,10 @@ reconcile_bundle_deps() { for (( i=0; i<${#changed_idx[@]}; i++ )); do printf ' %s %s -> %s\n' "${changed_name[$i]}" "${changed_oldver[$i]}" "${changed_newver[$i]}" done - return 0 + # report mode signals "there are changes to apply" via exit 2, so the + # caller can skip the apply prompt when nothing changed. Every other + # report exit (no change, no deps, fetch fail) returns 0. + return 2 fi # apply mode: recompute md5 only for changed lines, rewrite DOWNLOAD+MD5SUM. @@ -1325,12 +1331,17 @@ check_updates() { local murl; murl=$(manifest_url_for "$pkg" "$cur") || continue echo "" echo "Bundled-dep reconcile: $pkg (manifest @ $cur)" - reconcile_bundle_deps "$pkg" "$hintpath" "$murl" report || true - local ans - read -r -p "Apply bundled-dep updates for $pkg? [Y/n] " ans - ans="${ans:-Y}" - if [[ "$ans" =~ ^[Yy]$ ]]; then - reconcile_bundle_deps "$pkg" "$hintpath" "$murl" apply || true + local rc=0 + reconcile_bundle_deps "$pkg" "$hintpath" "$murl" report || rc=$? + # rc==2 means the report found changes to apply; anything else (0, or a + # real error) means nothing to prompt about. + if [[ $rc -eq 2 ]]; then + local ans + read -r -p "Apply bundled-dep updates for $pkg? [Y/n] " ans + ans="${ans:-Y}" + if [[ "$ans" =~ ^[Yy]$ ]]; then + reconcile_bundle_deps "$pkg" "$hintpath" "$murl" apply || true + fi fi done } @@ -1516,12 +1527,15 @@ main() { local _bm_url; _bm_url=$(manifest_url_for "$_bm_pkg" "$_bm_cur") echo "" echo "Bundled-dep reconcile: $_bm_pkg (manifest @ $_bm_cur)" - reconcile_bundle_deps "$_bm_pkg" "$_bm_hint" "$_bm_url" report || true - local _bm_ans - read -r -p "Apply bundled-dep updates for $_bm_pkg? [Y/n] " _bm_ans - _bm_ans="${_bm_ans:-Y}" - if [[ "$_bm_ans" =~ ^[Yy]$ ]]; then - reconcile_bundle_deps "$_bm_pkg" "$_bm_hint" "$_bm_url" apply || true + local _bm_rc=0 + reconcile_bundle_deps "$_bm_pkg" "$_bm_hint" "$_bm_url" report || _bm_rc=$? + if [[ $_bm_rc -eq 2 ]]; then + local _bm_ans + read -r -p "Apply bundled-dep updates for $_bm_pkg? [Y/n] " _bm_ans + _bm_ans="${_bm_ans:-Y}" + if [[ "$_bm_ans" =~ ^[Yy]$ ]]; then + reconcile_bundle_deps "$_bm_pkg" "$_bm_hint" "$_bm_url" apply || true + fi fi fi diff --git a/mkhint.1.gz b/mkhint.1.gz Binary files differindex 989fd53..cf7295c 100644 --- a/mkhint.1.gz +++ b/mkhint.1.gz diff --git a/mkhint.1.md b/mkhint.1.md index 2c910a1..5659145 100644 --- a/mkhint.1.md +++ b/mkhint.1.md @@ -1,4 +1,4 @@ -% MKHINT(1) mkhint 1.2.2 | User Commands +% MKHINT(1) mkhint 1.2.3 | User Commands % Danilo M. % July 2026 diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh index eac0fd2..30383d2 100755 --- a/tests/mkhint_test.sh +++ b/tests/mkhint_test.sh @@ -1817,6 +1817,27 @@ echo "$out" | grep -q 'deps not in hint:' && echo "$out" | grep -qi 'wasmtime' \ || { echo " FAIL: FYI. out=$out"; (( FAIL++ )); ERRORS+=("T-BM16"); } rm -f "$MOCK_BASE/manifest_fixture" "$MOCK_BASE/bundle-manifests" "$MOCK_HINT/bmnvim.hint" +# ── T-BM24: all-current reconcile does NOT prompt to apply ─────────────────── +# When the report finds no changed dep, the caller must skip the "Apply?" +# prompt entirely (report mode returns 0; a change returns 2). +echo "" +echo "T-BM24: --check --force, bundled deps all current → no apply prompt" +setup_bmnvim_check +# manifest tree-sitter at the SAME version as the hint (0.26.7), different shape +cat > "$MOCK_BASE/manifest_fixture" << 'EOF' +NVIM_URL https://github.com/neovim/neovim/archive/v0.13.0.tar.gz +NVIM_SHA256 a +TREESITTER_URL https://github.com/tree-sitter/tree-sitter/archive/v0.26.7.tar.gz +TREESITTER_SHA256 b +EOF +out=$(run_mkhint -C --force bmnvim < <(printf '\n') 2>&1) || true +echo "$out" | grep -q 'bundled deps all current' \ + && ! echo "$out" | grep -q 'Apply bundled-dep updates' \ + && grep -q 'v0.26.7' "$MOCK_HINT/bmnvim.hint" \ + && { echo " PASS: no prompt when all current"; (( PASS++ )); } \ + || { echo " FAIL: T-BM24 prompted on no-op. out=$out"; (( FAIL++ )); ERRORS+=("T-BM24"); } +rm -f "$MOCK_BASE/manifest_fixture" "$MOCK_BASE/bundle-manifests" "$MOCK_HINT/bmnvim.hint" + # ── T-BM18: --hintfile -V on a listed pkg reconciles bundled deps ──────────── echo "" echo "T-BM18: -f listed pkg -V bumps primary AND reconciles bundled deps" |
