Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle git pull errors #768

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions shift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -e
set -e # set exit on error; but its disabled later for sub_* commands

#### DB ####
export MYSQL_ROOT_PASSWORD=da642315cb2d390714590dad93e07c50
Expand Down Expand Up @@ -131,7 +131,8 @@ sub_ps() { # - Print service information

sub_pull() { # - Update the codebase to HEAD of currently deployed branch from https://github.com/shift-org/shift-docs
echo "pulling most recent commit from deployed branch of https://github.com/shift-org/shift-docs"
cd ${ROOT} ; git pull
cd ${ROOT}
git pull || exit 1
# forces a recreation and restart of the containers from their images
sub_up
}
Expand Down Expand Up @@ -169,12 +170,12 @@ sub_attach() { # <service> - Run bash on a running service
sub_compose() { # <cmd...> - Run a compose with associated files
OS=`uname`
if [ "$OS" == "Darwin" ] ; then
docker compose $@
docker compose $@
elif [ "$OS" == "Linux" ] ; then
docker-compose $@
docker-compose $@
else
echo "not sure how to handle your OS' version of docker. One of the above should work!"
exit 255
echo "not sure how to handle your OS' version of docker. One of the above should work!"
exit 255
fi
}

Expand Down Expand Up @@ -209,14 +210,14 @@ case ${SUB_CMD} in
*)
shift

set +e
set +e # disables exit on error
sub_${SUB_CMD} $@

if [ $? = 127 ]; then
echo "Error: '${SUB_CMD}' is not a known subcommand." >&2
echo " Run '${SCRIPT_NAME} --help' for a list of known subcommands." >&2
exit 1
fi
set -e
set -e # re-enables exit on error
;;
esac