Skip to content

Commit b42358a

Browse files
committed
Use patched git-subtree from bjorn3/git@tqc-subtree-portable
This patched has been necessary for subtree syncs from the start, but previously it was necessary to locally install tqc's patched git version, which hasn't been updated for quite a while. I made a small change to allow downloading it as script without requiring an entire git installation for the patched version.
1 parent db6fb61 commit b42358a

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ perf.data.old
1414
/dist
1515
/rust
1616
/download
17+
/git-fixed-subtree.sh

scripts/rustup.sh

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ set -e
44

55
TOOLCHAIN=${TOOLCHAIN:-$(date +%Y-%m-%d)}
66

7+
function check_git_fixed_subtree() {
8+
if [[ ! -e ./git-fixed-subtree.sh ]]; then
9+
echo "Missing git-fixed-subtree.sh. Please run the following commands to download it:"
10+
echo "curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/bjorn3/git/tqc-subtree-portable/contrib/subtree/git-subtree.sh -o git-fixed-subtree.sh"
11+
echo "chmod u+x git-fixed-subtree.sh"
12+
exit 1
13+
fi
14+
if [[ ! -x ./git-fixed-subtree.sh ]]; then
15+
echo "git-fixed-subtree.sh is not executable. Please run the following command to make it executable:"
16+
echo "chmod u+x git-fixed-subtree.sh"
17+
exit 1
18+
fi
19+
}
20+
721
case $1 in
822
"prepare")
923
echo "=> Installing new nightly"
@@ -27,29 +41,33 @@ case $1 in
2741
git commit -m "Rustup to $(rustc -V)"
2842
;;
2943
"push")
44+
check_git_fixed_subtree
45+
3046
cg_clif=$(pwd)
3147
pushd ../rust
3248
git pull origin master
3349
branch=sync_cg_clif-$(date +%Y-%m-%d)
3450
git checkout -b "$branch"
35-
git subtree pull --prefix=compiler/rustc_codegen_cranelift/ https://github.com/bjorn3/rustc_codegen_cranelift.git master
51+
"$cg_clif/git-fixed-subtree.sh" pull --prefix=compiler/rustc_codegen_cranelift/ https://github.com/bjorn3/rustc_codegen_cranelift.git master
3652
git push -u my "$branch"
3753

3854
# immediately merge the merge commit into cg_clif to prevent merge conflicts when syncing
3955
# from rust-lang/rust later
40-
git subtree push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
56+
"$cg_clif/git-fixed-subtree.sh" push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
4157
popd
4258
git merge sync_from_rust
4359
;;
4460
"pull")
61+
check_git_fixed_subtree
62+
4563
RUST_VERS=$(curl "https://static.rust-lang.org/dist/$TOOLCHAIN/channel-rust-nightly-git-commit-hash.txt")
4664
echo "Pulling $RUST_VERS ($TOOLCHAIN)"
4765

4866
cg_clif=$(pwd)
4967
pushd ../rust
5068
git fetch origin master
5169
git checkout "$RUST_VERS"
52-
git subtree push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
70+
"$cg_clif/git-fixed-subtree.sh" push --prefix=compiler/rustc_codegen_cranelift/ "$cg_clif" sync_from_rust
5371
popd
5472
git merge sync_from_rust -m "Sync from rust $RUST_VERS"
5573
git branch -d sync_from_rust

0 commit comments

Comments
 (0)