Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
claravanstaden authored and claravanstaden committed Feb 2, 2024
1 parent eb88286 commit 2b9ffb0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions bridges/snowbridge/scripts/contribute-upstream.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
# - readme
# - license

set -eu
set -e

# show CLI help
function show_help() {
set +x
echo " "
echo Error: $1
echo "Usage:"
echo " ./bridges/snowbridge/scripts/contribute-upstream.sh Exit with code 0 if pallets code is well decoupled from the other code in the repo"
echo " ./bridges/snowbridge/scripts/contribute-upstream.sh <branchname> Exit with code 0 if pallets code is well decoupled from the other code in the repo"
echo "Options:"
echo " --no-revert Leaves only runtime code on exit"
echo " --ignore-git-state Ignores git actual state"
Expand All @@ -41,6 +41,15 @@ do
esac
done

if [[ -z "$1" ]]; then
echo "Please provide a branch name you would like your upstream branch to be named"
exit 1
fi

branchname=$1

set -eu

# the script is able to work only on clean git copy, unless we want to ignore this check
[[ ! -z "${IGNORE_GIT_STATE}" ]] || [[ -z "$(git status --porcelain)" ]] || { echo >&2 "The git copy must be clean"; exit 1; }

Expand All @@ -55,6 +64,9 @@ trap revert_to_clean_state EXIT
# may be located either in call dir, or one of it subdirs.
SNOWBRIDGE_FOLDER="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/../.."

git branch "$branchname"
git checkout "$branchname"

# remove everything we think is not required for our needs
rm -rf rust-toolchain.toml
rm -rf $SNOWBRIDGE_FOLDER/.cargo
Expand Down

0 comments on commit 2b9ffb0

Please sign in to comment.