Commit 5717bc76 by Francisco Giordano

improve transpile-branch.sh script

(cherry picked from commit d4315671)
parent bde507c0
...@@ -29,5 +29,5 @@ jobs: ...@@ -29,5 +29,5 @@ jobs:
- run: npm ci - run: npm ci
if: steps.cache.outputs.cache-hit != 'true' if: steps.cache.outputs.cache-hit != 'true'
- run: bash scripts/upgrade-safe/git-user-config.sh - run: bash scripts/upgrade-safe/git-user-config.sh
- run: bash scripts/upgrade-safe/transpile-branch.sh master origin/master - run: bash scripts/upgrade-safe/transpile-onto.sh master origin/master
- run: git push origin master - run: git push origin master
...@@ -3,26 +3,36 @@ ...@@ -3,26 +3,36 @@
set -euo pipefail set -euo pipefail
if [ $# -lt 1 ]; then if [ $# -lt 1 ]; then
echo "usage: bash $0 <branch> [base]" >&2 echo "usage: bash $0 <target> [base]" >&2
exit 1 exit 1
fi fi
set -x set -x
branch="$1" target="$1"
base="${2:-}" base="${2-}"
bash scripts/upgrade-safe/transpile.sh bash scripts/upgrade-safe/transpile.sh
commit="$(git rev-parse --short HEAD)" commit="$(git rev-parse --short HEAD)"
branch="$(git rev-parse --abbrev-ref HEAD)"
git add contracts git add contracts
git checkout --orphan "$branch"
if [ -n "$base" ]; then git checkout --quiet --detach
if git rev-parse --quiet --verify "$target"; then
git reset --soft "$target"
git checkout "$target"
else
if [ -n "$base" ]; then
git reset --soft "$base" git reset --soft "$base"
fi
git checkout --orphan "$target"
fi fi
if ! git diff --cached --quiet; then if ! git diff --quiet --cached; then
git commit -m "Transpile $commit" git commit -m "Transpile $commit"
fi fi
git checkout "$branch"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment