2020-06-10 04:20:15 +00:00
#!/bin/sh
2020-06-10 03:40:48 +00:00
2021-02-25 23:51:14 +00:00
PROTECTED_BRANCH = "trunk"
2022-03-30 07:44:51 +00:00
CURRENT_BRANCH = $( git branch --show-current)
if [ $PROTECTED_BRANCH = $CURRENT_BRANCH ] ; then
if [ " $TERM " = "dumb" ] ; then
>& 2 echo " Sorry, you are unable to push to $PROTECTED_BRANCH using a GUI client! Please use git CLI. "
exit 1
fi
2020-06-10 04:20:15 +00:00
2022-03-30 07:44:51 +00:00
printf " %sYou're about to push to $PROTECTED_BRANCH , is that what you intended? [y/N]: %s " " $( tput setaf 3) " " $( tput sgr0) "
read -r PROCEED < /dev/tty
echo
2020-06-10 03:40:48 +00:00
2022-03-30 07:44:51 +00:00
if [ " $( echo " ${ PROCEED :- n } " | tr "[:upper:]" "[:lower:]" ) " = "y" ] ; then
echo " $( tput setaf 2) Brace yourself! Pushing to the $PROTECTED_BRANCH branch... $( tput sgr0) "
2020-06-10 03:40:48 +00:00
echo
2022-03-30 07:44:51 +00:00
exit 0
2020-06-10 03:40:48 +00:00
fi
2022-03-30 07:44:51 +00:00
echo " $( tput setaf 2) Push to $PROTECTED_BRANCH cancelled! $( tput sgr0) "
echo
exit 1
2020-06-10 03:40:48 +00:00
fi
2022-07-20 13:09:48 +00:00
2022-08-24 15:15:22 +00:00
pnpm exec syncpack -- list-mismatches
if [ $? -ne 0 ] ; then
echo "You must sync the dependencies listed above before you can push this branch."
2023-12-06 19:36:12 +00:00
echo "This can usually be accomplished automatically by updating the pinned version in \`.syncpackrc\` and then running \`pnpm run sync-dependencies\`."
2022-08-24 15:15:22 +00:00
exit 1
fi