fix(tools): format-all passes its own arguments on when it re-runs inside the dev shell

format-all re-executes itself under 'nix develop' to get the nightly rustfmt, but it did so after its argument loop had shifted every argument away, so the re-run always used the defaults (--check, all trees): '--apply' silently only checked. The original arguments are now saved before parsing and passed on. Found when applying the final formatting of candidate 8: '--apply --tree windows' printed diffs and changed nothing. Verified: bash -n; the revisions after this one are the result of running --apply.
This commit is contained in:
LGUG2Z committed 2026-11-05 15:03:27 -08:00
1 parent 6686273bee
commit c670ab35c8
1 file changed
+2 -1
+2 -1
View File
@@ -21,6 +21,7 @@
# pinned rust-overlay; another nightly may format a little differently).
set -uo pipefail
orig_args=("$@")
mode=check
tree=all
root=$(cd "$(dirname "$0")/.." && pwd)
@@ -41,7 +42,7 @@ if [ -z "${RUSTFMT:-}" ]; then
if rustfmt --version 2>/dev/null | grep -q nightly; then
RUSTFMT=rustfmt
elif [ -z "${FORMAT_ALL_IN_SHELL:-}" ] && command -v nix >/dev/null; then
FORMAT_ALL_IN_SHELL=1 exec nix develop "$root" --command "$0" "$@" --root "$root"
FORMAT_ALL_IN_SHELL=1 exec nix develop "$root" --command "$0" "${orig_args[@]}" --root "$root"
else
echo "format-all: no nightly rustfmt (set RUSTFMT)" >&2; exit 2
fi