Replace script/update-policy with a short wget-and-commit script (closes #165) #181
@@ -19,6 +19,7 @@ die() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
cd "$ROOT"
|
cd "$ROOT"
|
||||||
[ ! -e prompts/REPO_POLICIES.md ] ||
|
[ ! -e prompts/REPO_POLICIES.md ] ||
|
||||||
die "this is the prompts repo, where these files come from"
|
die "this is the prompts repo, where these files come from"
|
||||||
@@ -33,9 +34,9 @@ done
|
|||||||
[ -z "$(git status --porcelain -- $paths)" ] ||
|
[ -z "$(git status --porcelain -- $paths)" ] ||
|
||||||
die "commit or discard your changes to these files first:$paths"
|
die "commit or discard your changes to these files first:$paths"
|
||||||
|
|
||||||
# Every file is fetched before any is replaced. The temporary directory
|
# Every file is fetched before any is replaced. The temporary
|
||||||
# is inside the repo so that mv renames: the running script is replaced
|
# directory is inside the repo so that mv renames: the running script
|
||||||
# by a new file, never rewritten in place.
|
# is replaced by a new file, never rewritten in place.
|
||||||
tmp="$(mktemp -d "$ROOT/.update-policy.XXXXXX")"
|
tmp="$(mktemp -d "$ROOT/.update-policy.XXXXXX")"
|
||||||
trap 'rm -rf "$tmp"' EXIT
|
trap 'rm -rf "$tmp"' EXIT
|
||||||
for entry in $FILES; do
|
for entry in $FILES; do
|
||||||
@@ -57,3 +58,6 @@ else
|
|||||||
git commit -q -m "Update policy files from prompts" -- $paths
|
git commit -q -m "Update policy files from prompts" -- $paths
|
||||||
echo "update-policy: committed; review it, then push"
|
echo "update-policy: committed; review it, then push"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
Reference in new issue
Block a user