mirror of
https://github.com/dtolnay/install.git
synced 2024-11-21 16:09:32 +01:00
Add a script for rebasing crate branches
This commit is contained in:
parent
4507de1760
commit
e6ff5751b5
1 changed files with 40 additions and 0 deletions
40
scripts/rebase.sh
Executable file
40
scripts/rebase.sh
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
|
||||
|
||||
if ! git diff-index --quiet HEAD; then
|
||||
echo "Not running rebase.sh because git working directory is dirty" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: scripts/rebase.sh [crate]..." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
base=$(git rev-parse HEAD)
|
||||
push=()
|
||||
|
||||
(
|
||||
set -x
|
||||
git fetch --quiet origin --tags
|
||||
)
|
||||
|
||||
for crate in "$@"; do
|
||||
(
|
||||
set -x
|
||||
git tag -d "$crate" &>/dev/null || true
|
||||
git checkout --quiet origin/"$crate"
|
||||
git rebase --quiet "$base"
|
||||
)
|
||||
push+=("$(git rev-parse HEAD):refs/heads/$crate")
|
||||
done
|
||||
|
||||
(
|
||||
set -x
|
||||
git checkout --quiet "$base"
|
||||
)
|
||||
|
||||
git push origin --force-with-lease "${push[@]}"
|
Loading…
Reference in a new issue