Skip to content

Commit

Permalink
Add a --force flag to the sync script (#473)
Browse files Browse the repository at this point in the history
This is useful to bypass the check for the book examples, which
over-triggers when moving between before and after #445.
  • Loading branch information
ia0 committed May 16, 2024
1 parent e226a5b commit 8318ea7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,18 @@ set -e

# This script synchronizes generated content.

[ "$1" = --force ] && FORCE=y

cargo xtask update-apis

book_example() {
local src=book/src/applet/prelude/$1.rs
local dst=examples/rust/$2/src/lib.rs
# We only check that the destination is newer by more than one second, because when cloning the
# repository or switching branches, it may happen that the destination is slightly newer.
if [ $(stat -c%Y $dst) -gt $(($(stat -c%Y $src) + 1)) ]; then
if [ -z "$FORCE" -a $(stat -c%Y $dst) -gt $(($(stat -c%Y $src) + 1)) ]; then
t "Update $src instead of $dst"
i "If you switched branch and did not modify those files, rerun with --force"
e "$dst seems to have been manually modified"
fi
# Besides removing all anchors, we insert a warning before the #![no_std] line, which all examples
Expand Down

0 comments on commit 8318ea7

Please sign in to comment.