script/install: stop on a repo's own script of the same name
check / check (push) Successful in 26s

script/install replaced any tracked script/install or
script/update-policy in the target, including a repo's own unrelated
script. It now stops when such a file has a line the canonical file
has never held. An older shared copy is still replaced.

The padded file in the self-replacement test is now an earlier
canonical version, so the new stop does not catch it.

Model: opus-5-5
This commit is contained in:
clawbot committed 2026-11-09 18:49:16 +00:00
1 parent 454f3410a1
commit f4275b9ac0
3 files changed
+43 -2

No files matched your search

+16
View File
@@ -174,6 +174,19 @@ $own"
fi
}
# stop_on_own_script <fetched> <local>: stop if the local script has a
# line the canonical file has never held, unless it is blank or a
# comment: the repo wrote that script itself, and replacing it would
# delete it. A repo without the script is fine.
stop_on_own_script() {
[ -e "$2" ] || return 0
own="$(local_only_lines "$1" "$2")"
if [ -n "$own" ]; then
die "$2 has lines the canonical file has never held; rename the repo's own script to keep it:
$own"
fi
}
main() {
[ "$#" -le 1 ] || die "usage: script/install [path of a repo clone]"
@@ -221,6 +234,9 @@ main() {
.golangci.yml)
keep_deny_entries "$tmp/$path" "$path"
;;
script/*)
stop_on_own_script "$tmp/$path" "$path"
;;
esac
done