Skip to content

Commit cdf19b5

Browse files
committed
update.sh: Allow specifying ref to pull from.
Previously, we could only update to rust-lang/rust master. But now we need to publish multiple format versions, as there's a backlog that have landed upstream but not here. (#50).
1 parent 59e3a23 commit cdf19b5

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

update.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,26 @@ pyjq() {
44
python3 -c "import json, sys; print(json.load(sys.stdin)${1})"
55
}
66

7+
case "$#" in
8+
0)
9+
ref="master"
10+
;;
11+
1)
12+
ref="$1"
13+
;;
14+
2)
15+
echo "usage: ./update.sh [ref]"
16+
exit 1
17+
;;
18+
esac
19+
720
user="rust-lang"
821
repo="rust"
9-
branch="master"
1022

11-
curl -# https://raw.githubusercontent.com/${user}/${repo}/${branch}/src/rustdoc-json-types/lib.rs \
23+
curl -# https://raw.githubusercontent.com/${user}/${repo}/${ref}/src/rustdoc-json-types/lib.rs \
1224
| sed '/^pub type FxHashMap.*$/d' \
1325
> src/lib.rs
1426

15-
curl -# https://raw.githubusercontent.com/${user}/${repo}/${branch}/src/rustdoc-json-types/tests.rs > src/tests.rs
27+
curl -# https://raw.githubusercontent.com/${user}/${repo}/${ref}/src/rustdoc-json-types/tests.rs > src/tests.rs
1628

17-
curl -# "https://api.github.com/repos/${user}/${repo}/commits?sha=${branch}&path=src/rustdoc-json-types/lib.rs" | pyjq '[0]["sha"]' > COMMIT.txt
29+
curl -# "https://api.github.com/repos/${user}/${repo}/commits?sha=${ref}&path=src/rustdoc-json-types/lib.rs" | pyjq '[0]["sha"]' > COMMIT.txt

0 commit comments

Comments
 (0)