diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-09 19:14:21 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-09 19:14:21 +0200 |
| commit | 1ec3a154e045c2b39d57589530156c3d61902c79 (patch) | |
| tree | fa1f5ef4a3e81eaee3ba0a7ab8101fa2391b0f4d | |
| parent | 63fe4c87855ef0be12c624fee9febd67f04aa98f (diff) | |
| download | mkhintfile-1ec3a154e045c2b39d57589530156c3d61902c79.tar.gz mkhintfile-1ec3a154e045c2b39d57589530156c3d61902c79.zip | |
refactor: split reconcile into url/sha dispatch, url logic unchanged
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rwxr-xr-x | mkhint | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -584,14 +584,29 @@ fetch_manifest() { printf '%s\n' "$out" } -# reconcile_bundle_deps <pkg> <hintfile> <manifest_url> <mode> +# reconcile_bundle_deps <pkg> <hintfile> <manifest_url_or_ignored> <mode-arg> +# Dispatch on the package's configured bundle mode. url-mode uses the manifest +# URL argument (as before); sha-mode ignores it and reads BUNDLE_REST. Keeps the +# three existing call sites unchanged. Returns whatever the mode handler returns. +reconcile_bundle_deps() { + local pkg="$1" + case "${BUNDLE_MODE[$pkg]:-url}" in + sha) reconcile_bundle_deps_sha "$@" ;; + *) reconcile_bundle_deps_url "$@" ;; + esac +} + +# TEMPORARY stub for sha-mode; real body arrives in a later task. +reconcile_bundle_deps_sha() { echo " $1: sha-mode not yet implemented"; return 0; } + +# reconcile_bundle_deps_url <pkg> <hintfile> <manifest_url> <mode> # 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() { +reconcile_bundle_deps_url() { local pkg="$1" hint="$2" murl="$3" mode="$4" # Display label for a dep URL: _url_stem is basename-only, so for a github |
